Skip to content

Bump typescript-eslint from 8.14.0 to 8.15.0 (#110) #70

Bump typescript-eslint from 8.14.0 to 8.15.0 (#110)

Bump typescript-eslint from 8.14.0 to 8.15.0 (#110) #70

# This workflow is used to package and push the dist folder to the specified branch (main or release branch)
# It is triggered by a push to the main branch or any release branch. The release branch must be in the format "releases/x.y.z"
# and is created by the create release branch workflow.
name: Build, Push, and Release
on:
push:
branches:
- main
- "releases/**"
paths:
- "src/**"
- "package.json"
- "package-lock.json"
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Important for GitVersion
# Install GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected] # cSpell: ignore gittools
with:
versionSpec: "6.x"
# Determine the version using GitVersion
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
configFilePath: gitversion.yml
# Setup Node.js environment
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
# Install dependencies
- name: Install dependencies
run: npm ci
# Build the project
- name: Build
run: npm run build
# Check if dist folder has changed
- name: Check for dist changes
id: check_dist_changes
run: |
git status
git add dist
if [ -n "$(git diff --name-only --staged)" ]; then
echo "dist_changed=true" >> $GITHUB_OUTPUT
else
echo "dist_changed=false" >> $GITHUB_OUTPUT
fi
# Notify if no changes to release or pre-release
- name: Notify no changes
if: steps.check_dist_changes.outputs.dist_changed == 'false'
run: echo "::notice::There were no changes to release or pre-release."
# Update the version in package.json if dist has changed
- name: Update package.json version
if: steps.check_dist_changes.outputs.dist_changed == 'true'
run: |
VERSION=${{ steps.gitversion.outputs.semVer }}
echo "Updating package.json version to $VERSION"
npm version $VERSION --no-git-tag-version
git add package.json package-lock.json
# Commit and push changes if there are any
- name: Commit and push if changed
if: steps.check_dist_changes.outputs.dist_changed == 'true'
run: |
git status
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
BRANCH_NAME="update-version-${{ steps.gitversion.outputs.semVer }}"
git checkout -b $BRANCH_NAME
git commit -m "Automated build: Package Relabeler v${{ steps.gitversion.outputs.semVer }}"
git push origin $BRANCH_NAME
BASE_BRANCH=$(if [[ "${GITHUB_REF}" == refs/heads/releases/* ]]; then echo "${GITHUB_REF#refs/heads/}"; else echo "main"; fi)
gh pr create --title "Automated build: Package Relabeler v${{ steps.gitversion.outputs.semVer }}" --body "This PR rebuilds the dist folder and updates the version to ${{ steps.gitversion.outputs.semVer }}." --base $BASE_BRANCH --head $BRANCH_NAME
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This is needed for the gh cli
# Create a preview tag if on the main branch and dist has changed
- name: Create Preview Tag
if: github.ref == 'refs/heads/main' && steps.check_dist_changes.outputs.dist_changed == 'true'
run: |
git tag v${{ steps.gitversion.outputs.semVer }}
git push origin v${{ steps.gitversion.outputs.semVer }}
# Create a preview release for the preview tag if on the main branch and dist has changed
- name: Create GitHub Preview Release
if: github.ref == 'refs/heads/main' && steps.check_dist_changes.outputs.dist_changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ steps.gitversion.outputs.semVer }} \
--title "Preview Release ${{ steps.gitversion.outputs.semVer }}" \
--notes "This is a preview release for version ${{ steps.gitversion.outputs.semVer }}." \
--generate-notes \
--notes-start-tag "v${{ steps.gitversion.outputs.semVer }}" \
--prerelease
# Create Release if on a release branch and dist has changed
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/heads/releases/') && steps.check_dist_changes.outputs.dist_changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ steps.gitversion.outputs.semVer }} \
--title "Release ${{ steps.gitversion.outputs.semVer }}" \
--notes "Release ${{ steps.gitversion.outputs.semVer }} of the action. This release includes the latest built version of the dist folder." \
--target $GITHUB_SHA