@@ -465,7 +465,7 @@ jobs:
465465 outputs :
466466 version : ${{ steps.compute-express-git-tag.outputs.version }}
467467 git-tag : ${{ steps.compute-express-git-tag.outputs.git-tag }}
468- git-sha : ${{ steps.compute -express-git-sha .outputs.git-sha }}
468+ git-sha : ${{ steps.verify -express-git-tag .outputs.git-sha }}
469469 docker-exists : ${{ steps.check-docker-image.outputs.docker-exists }}
470470 steps :
471471 # Check out the exact commit the release was published from.
@@ -486,16 +486,11 @@ jobs:
486486 echo "version=$VERSION" >> "$GITHUB_OUTPUT"
487487 echo "git-tag=$TAG" >> "$GITHUB_OUTPUT"
488488
489- - name : Parse express git SHA
490- id : compute-express-git-sha
491- run : |
492- GIT_SHA=$(git rev-parse HEAD)
493- echo "Git SHA: $GIT_SHA"
494- echo "git-sha=$GIT_SHA" >> "$GITHUB_OUTPUT"
495-
496- # The express git tag must resolve to a commit that carries the released
497- # express version and is part of the published release history.
498- - name : Verify Express Git Tag Points at Release Commit
489+ # The express git tag must resolve to the express version bump commit
490+ # (its parent carries a different version) within the published release
491+ # history. The Docker build uses this verified tag commit.
492+ - name : Verify Express Git Tag
493+ id : verify-express-git-tag
499494 run : |
500495 PUBLISH_SHA="${{ needs.release-bitgojs.outputs.publish-sha }}"
501496 TAG="${{ steps.compute-express-git-tag.outputs.git-tag }}"
@@ -513,13 +508,21 @@ jobs:
513508 exit 1
514509 fi
515510
511+ VERSION_AT_PARENT=$(git show "${TAG_SHA}^:modules/express/package.json" | jq -r '.version')
512+ if [ "$VERSION_AT_PARENT" = "$VERSION_AT_TAG" ]; then
513+ echo "::error::Express git tag $TAG points at $TAG_SHA which is not the commit that bumped the express version to $VERSION."
514+ echo "::error::The tag may have been moved after the release. Refusing to build the Express Docker image."
515+ exit 1
516+ fi
517+
516518 if ! git merge-base --is-ancestor "$TAG_SHA" "$PUBLISH_SHA"; then
517519 echo "::error::Express git tag $TAG points at $TAG_SHA which is not part of the published release history (publish SHA $PUBLISH_SHA)."
518520 echo "::error::The tag may have been moved after the release. Refusing to build the Express Docker image."
519521 exit 1
520522 fi
521523
522- echo "✅ Express git tag points at the published release commit"
524+ echo "✅ Express git tag verified; building from the tagged commit"
525+ echo "git-sha=$TAG_SHA" >> "$GITHUB_OUTPUT"
523526
524527 - name : Check if Docker image already exists in Docker Hub
525528 id : check-docker-image
@@ -546,7 +549,7 @@ jobs:
546549 echo ""
547550 echo "Express Version: ${{ steps.compute-express-git-tag.outputs.version }}"
548551 echo "Git Tag: ${{ steps.compute-express-git-tag.outputs.git-tag }}"
549- echo "Commit SHA: ${{ steps.compute -express-git-sha .outputs.git-sha }}"
552+ echo "Commit SHA (verified) : ${{ steps.verify -express-git-tag .outputs.git-sha }}"
550553 echo "Publish SHA (verified): ${{ needs.release-bitgojs.outputs.publish-sha }}"
551554 echo ""
552555 echo "### Docker Images to be deployed:"
0 commit comments