From bd40ab105c6baa3b0e1e37910ed84c871ec09fa3 Mon Sep 17 00:00:00 2001 From: Jordan Minkive Date: Tue, 18 Nov 2025 19:49:06 -0500 Subject: [PATCH 1/3] Refactor GitHub Actions workflows for build and release process --- .github/workflows/build.yml | 75 +++++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 21 +++++------ 2 files changed, 85 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b569ca6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,75 @@ + + +on: + workflow_call: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Check for [skip] in PR title + id: check_skip + run: | + pr_title="${{ github.event.pull_request.title }}" + + if [[ "$pr_title" == "[Skip]"* ]]; then + echo "skip=true" >> $GITHUB_ENV + else + echo "skip=false" >> $GITHUB_ENV + fi + + - name: Verify PR title + if: env.skip == 'false' + id: determine_increment + run: | + pr_title="${{ github.event.pull_request.title }}" + latest_tag=${{ env.latest_tag }} + + # Extract major, minor, and patch components from the latest tag + major=$(echo $latest_tag | cut -d. -f1 | sed 's/v//') + minor=$(echo $latest_tag | cut -d. -f2) + patch=$(echo $latest_tag | cut -d. -f3) + + # Determine the increment type based on PR title + if [[ "$pr_title" == "[Major]"* ]]; then + major=$((major + 1)) + minor=0 + patch=0 + elif [[ "$pr_title" == "[Minor]"* ]]; then + minor=$((minor + 1)) + patch=0 + elif [[ "$pr_title" == "[Patch]"* ]]; then + patch=$((patch + 1)) + else + echo "PR title must start with [Major], [Minor], or [Patch]." + exit 1 + fi + + # Construct the new tag + new_tag="v${major}.${minor}.${patch}" + echo "new_tag=$new_tag" >> $GITHUB_ENV + + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + + - name: Install dependencies + run: npm i + + - name: Build the project + run: npm run build + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4feef9f..5aee6c6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,11 @@ permissions: jobs: build: + uses: ./.github/workflows/build.yml + + release: if: github.event.pull_request.merged == true + needs: build runs-on: ubuntu-latest steps: @@ -18,16 +22,11 @@ jobs: with: fetch-depth: 0 - - name: Set up Node.js - uses: actions/setup-node@v4 + - name: Download build artifacts + uses: actions/download-artifact@v4 with: - node-version: 'lts/*' - - - name: Install dependencies - run: npm i - - - name: Build the project - run: npm run build + name: dist + path: dist/ - name: Debug dist folder run: ls -la dist @@ -164,8 +163,8 @@ jobs: rollback: runs-on: ubuntu-latest - needs: build - if: failure() # Only run if the build job fails + needs: release + if: failure() # Only run if the release job fails steps: - name: Download tag artifact From b944ee3cab7096c138da3ad8facc0809de5efe57 Mon Sep 17 00:00:00 2001 From: Jordan Minkive Date: Tue, 18 Nov 2025 19:53:45 -0500 Subject: [PATCH 2/3] Update GitHub Actions workflow for improved build process --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b569ca6..d9a1642 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,4 +72,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: dist - path: dist/ \ No newline at end of file + path: dist/ From 2233de156a32c5e3fd9139b0a4053313a566ee49 Mon Sep 17 00:00:00 2001 From: Jordan Minkive Date: Tue, 18 Nov 2025 19:55:29 -0500 Subject: [PATCH 3/3] Add npm deprecation step to release job in GitHub Actions workflow --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5aee6c6..0d4f461 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -204,3 +204,4 @@ jobs: npm deprecate $tag "Deprecation reason" || echo "Package not found" env: NPM_TOKEN: ${{ secrets.NPM_PUBLISH_KEY }} +