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
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ jobs:
- name: Install
run: npm ci

# The tag decides *when* to publish; package.json decides *what* version
# is published. Nothing tied the two together, so `git tag v0.2.0` on a
# tree still saying 0.1.0 would publish 0.1.0 — or fail as "already
# published" — with the tag claiming otherwise. Fail before the registry
# call instead, while it is still free to fix.
- name: Tag must match package.json version
run: |
tag_version="${GITHUB_REF_NAME#v}"
pkg_version="$(node -p "require('./package.json').version")"
if [ "$tag_version" != "$pkg_version" ]; then
echo "tag ${GITHUB_REF_NAME} implies version ${tag_version}," >&2
echo "but package.json says ${pkg_version}. Bump package.json or retag." >&2
exit 1
fi
echo "publishing ${pkg_version} from tag ${GITHUB_REF_NAME}"

- name: Verify pack contents
run: |
npm pack --dry-run 2>&1 | tee /tmp/pack.txt
Expand Down
Loading