Skip to content

Commit 4424655

Browse files
committed
fix: Only try to publish when version has changed
1 parent ae0d6a5 commit 4424655

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/publish.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
push:
66
branches:
77
- main
8+
paths:
9+
- deno.json
810

911
jobs:
1012
publish:
@@ -19,9 +21,16 @@ jobs:
1921
node-version: "20.x"
2022
registry-url: "https://registry.npmjs.org"
2123
- uses: denoland/setup-deno@v1
22-
- run: deno run -A scripts/npm.ts
24+
- run: |
25+
echo "DENO_VERSION=$(cat deno.json | jq \".version\")" >> $GITHUB_ENV
26+
echo "NPM_VERSION=$(npm info @denosaurs/typefetch --json | jq \".['dist-tags'].latest\")" >> $GITHUB_ENV
27+
echo "JSR_VERSION=$(curl -s https://jsr.io/@denosaurs/typefetch/meta.json | jq \".latest\")" >> $GITHUB_ENV
2328
- run: deno publish
29+
if: ${{ env.DENO_VERSION != env.JSR_VERSION }}
30+
- run: deno run -A scripts/npm.ts
31+
if: ${{ env.DENO_VERSION != env.NPM_VERSION }}
2432
- run: npm publish --provenance --access public
33+
if: ${{ env.DENO_VERSION != env.NPM_VERSION }}
2534
working-directory: ./npm
2635
env:
2736
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)