-
-
Notifications
You must be signed in to change notification settings - Fork 63
52 lines (43 loc) · 1.59 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Publish
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org
cache: npm
- name: Install dependencies
run: npm ci
- name: Update package version to latest tag
run: |
# Set up git user
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
npm version --allow-same-version from-git
git push --follow-tags origin HEAD:main
- name: Create jsr.json based on package.json
run: |
node -e '
const p = require("./package.json");
const jsrJson = {
name: `@cheerio/${p.name}`,
version: p.version,
...p.tshy,
};
require("fs").writeFileSync("./jsr.json", JSON.stringify(jsrJson, null, 2));
'
- name: Publish package to JSR
run: npx jsr publish
- name: Publish package to NPM
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}