Skip to content

Commit 0147dd6

Browse files
committed
ci: Add a version check to the JSR publish workflow to ensure deno.json version matches the Git tag.
1 parent 3f6c2cf commit 0147dd6

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/publish-jsr.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,21 @@ jobs:
3434
- name: Run tests
3535
run: deno task test
3636

37+
- name: Check version match
38+
if: startsWith(github.ref, 'refs/tags/')
39+
env:
40+
TAG_NAME: ${{ github.ref_name }}
41+
run: |
42+
FILE_VERSION=$(deno eval 'console.log(JSON.parse(Deno.readTextFileSync("deno.json")).version)')
43+
TAG_VERSION=${TAG_NAME#v}
44+
45+
echo "File version: $FILE_VERSION"
46+
echo "Tag version: $TAG_VERSION"
47+
48+
if [ "$FILE_VERSION" != "$TAG_VERSION" ]; then
49+
echo "::error::Version mismatch! deno.json has $FILE_VERSION but tag is $TAG_VERSION"
50+
exit 1
51+
fi
52+
3753
- name: Publish to JSR
3854
run: deno publish

0 commit comments

Comments
 (0)