From a8c6ceb5da7697533e8117fc70513a0ddafed667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20Sj=C3=B6green?= Date: Wed, 18 Dec 2024 10:19:26 +0100 Subject: [PATCH] fix: Only try to publish when version has changed (#18) --- .github/workflows/publish.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a675674..797f1ff 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,6 +5,8 @@ on: push: branches: - main + paths: + - deno.json jobs: publish: @@ -19,9 +21,16 @@ jobs: node-version: "20.x" registry-url: "https://registry.npmjs.org" - uses: denoland/setup-deno@v1 - - run: deno run -A scripts/npm.ts + - run: | + echo "DENO_VERSION=$(cat deno.json | jq \".version\")" >> $GITHUB_ENV + echo "NPM_VERSION=$(npm info @denosaurs/typefetch --json | jq \".['dist-tags'].latest\")" >> $GITHUB_ENV + echo "JSR_VERSION=$(curl -s https://jsr.io/@denosaurs/typefetch/meta.json | jq \".latest\")" >> $GITHUB_ENV - run: deno publish + if: ${{ env.DENO_VERSION != env.JSR_VERSION }} + - run: deno run -A scripts/npm.ts + if: ${{ env.DENO_VERSION != env.NPM_VERSION }} - run: npm publish --provenance --access public + if: ${{ env.DENO_VERSION != env.NPM_VERSION }} working-directory: ./npm env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}