File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Check Deno Version Change
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - main
7+ types :
8+ - opened
9+ - synchronize
10+ - reopened
11+
12+ jobs :
13+ check-version :
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - name : Checkout PR branch
18+ uses : actions/checkout@v4
19+
20+ - name : Compare version in deno.json
21+ run : |
22+ PR_VERSION=$(jq -r '.version' deno.json)
23+
24+ MAIN_DENO_JSON=$(curl -s -H "Authorization: token ${{ github.token }}" \
25+ "https://api.github.com/repos/${{ github.repository }}/contents/deno.json?ref=main" | \
26+ jq -r '.content' | base64 -d)
27+
28+ MAIN_VERSION=$(echo "$MAIN_DENO_JSON" | jq -r '.version')
29+
30+ echo "PR version: $PR_VERSION"
31+ echo "Main version: $MAIN_VERSION"
32+
33+ if [ "$PR_VERSION" = "$MAIN_VERSION" ]; then
34+ echo "❌ Version in deno.json has not changed compared to main"
35+ exit 1
36+ else
37+ echo "✅ Version has changed from $MAIN_VERSION to $PR_VERSION"
38+ fi
Original file line number Diff line number Diff line change @@ -2,14 +2,14 @@ name: Publish to JSR
22
33on :
44 push :
5- tags :
6- - ' v* ' # Triggers on version tags like v0.1.0
5+ branches :
6+ - main
77
88jobs :
99 publish :
1010 runs-on : ubuntu-latest
1111 permissions :
12- contents : read
12+ contents : write # Needed to push tags
1313 id-token : write # For Deno to authenticate with JSR
1414
1515 steps :
2121 with :
2222 deno-version : v2.x
2323
24+ - name : Extract version from deno.json
25+ id : get_version
26+ run : |
27+ VERSION=$(jq -r '.version' deno.json)
28+ echo "VERSION=$VERSION" >> $GITHUB_ENV
29+ echo "Version is $VERSION"
30+
31+ - name : Configure Git identity
32+ run : |
33+ git config user.name "${{ github.actor }}"
34+ git config user.email "${{ github.actor }}@users.noreply.github.com"
35+
36+ - name : Create Git tag
37+ run : |
38+ git tag "v$VERSION"
39+ git push origin "v$VERSION"
40+
2441 - name : Publish to JSR
2542 run : deno publish
You can’t perform that action at this time.
0 commit comments