Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/push-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,36 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Validate tag is on trunk
run: |
set -euo pipefail

if [[ "${GITHUB_REF}" != refs/tags/* ]]; then
echo "Error: GITHUB_REF does not begin with refs/tags/" >&2
exit 1
fi

# For tag pushes, GitHub exposes the tag name in GITHUB_REF_NAME.
tag_ref="${GITHUB_REF_NAME}"

if [[ -z "${tag_ref}" ]]; then
echo "Error: GITHUB_REF_NAME is empty." >&2
exit 1
fi

if ! tag_commit=$(git rev-parse --verify "${tag_ref}^{commit}" 2>/dev/null); then
echo "Error: tag reference '${tag_ref}' does not exist or is not valid." >&2
exit 1
fi

# Ensure trunk is available locally, then verify the tag commit is on trunk.
git fetch origin trunk

if ! git merge-base --is-ancestor "${tag_commit}" "origin/trunk"; then
echo "Error: tag '${tag_ref}' is not on branch 'trunk'." >&2
exit 1
fi

- name: Build
run: |
npm install
Expand Down
Loading