Skip to content

fix: Only try to publish when version has changed (#18) #56

fix: Only try to publish when version has changed (#18)

fix: Only try to publish when version has changed (#18) #56

Workflow file for this run

name: Publish
on:
workflow_dispatch:
push:
branches:
- main
paths:
- deno.json
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- uses: denoland/setup-deno@v1
- run: |
echo "DENO_VERSION=$(cat deno.json | jq \".version\")" >> $GITHUB_ENV

Check failure on line 25 in .github/workflows/publish.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish.yml

Invalid workflow file

You have an error in your yaml syntax on line 25
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 }}