Skip to content

Make test-and-publish no-op on tag/version mismatch instead of failing - #2

Merged
MR-1124 merged 2 commits into
mainfrom
copilot/fix-test-and-publish-job
Sep 2, 2026
Merged

Make test-and-publish no-op on tag/version mismatch instead of failing#2
MR-1124 merged 2 commits into
mainfrom
copilot/fix-test-and-publish-job

Conversation

Copilot AI commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

test-and-publish was failing on historical/incorrect tag pushes because the release workflow exited non-zero when GITHUB_REF did not match package.json version. This change keeps strict version gating while preventing false-negative release failures.

  • Version guard behavior

    • Converted the tag check into an output-producing guard step (id: version_guard).
    • On mismatch, the workflow now emits a warning and sets matched=false instead of failing the job.
  • Release pipeline gating

    • Added if: steps.version_guard.outputs.matched == 'true' to all downstream release steps (npm ci, tests, smoke/cleanup, publish, registry verification, GitHub Release).
    • Result: matching tags continue full release flow; mismatched tags become an explicit no-op.
  • Relevant workflow pattern

    - name: Check tag matches package.json version
      id: version_guard
      run: |
        TAG="${GITHUB_REF#refs/tags/}"
        V="v$(node -p "require('./package.json').version")"
        if [ "$TAG" != "$V" ]; then
          echo "::warning::tag ${TAG} does not match package.json version ${V} — skipping publish workflow"
          echo "matched=false" >> "$GITHUB_OUTPUT"
          exit 0
        fi
        echo "matched=true" >> "$GITHUB_OUTPUT"
    
    - name: Install dependencies
      if: steps.version_guard.outputs.matched == 'true'
      run: npm ci

Co-authored-by: MR-1124 <139001429+MR-1124@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job test-and-publish Make test-and-publish no-op on tag/version mismatch instead of failing Sep 2, 2026
Copilot AI requested a review from MR-1124 September 2, 2026 19:40
@MR-1124
MR-1124 marked this pull request as ready for review September 2, 2026 19:53
@MR-1124
MR-1124 merged commit 7e539ef into main Sep 2, 2026
1 check passed
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

🚀 Preview deploy ready: http://localhost:8787/sample-site/preview-preview/

Deployed by deploy-cli on PR #2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants