-
Notifications
You must be signed in to change notification settings - Fork 1
36 lines (34 loc) · 1.1 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
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 }}