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 }}