-
Notifications
You must be signed in to change notification settings - Fork 3
105 lines (90 loc) · 2.95 KB
/
publish-js.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Publish javascript 🟢 package to npmjs 📦
on:
push:
tags:
# e.g., js/tauri-plugin-pytauri-api/v0.1.0
- js/*/v*
defaults:
run:
shell: bash
# NOTE: It's better not to use cache for release workflow.
jobs:
dry-run:
name: pnpm publish dry-run
runs-on: ubuntu-latest
outputs:
package: ${{ steps.dry-run.outputs.package }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
# see: <https://github.com/pnpm/action-setup>
- name: Install pnpm
uses: pnpm/action-setup@v4
# see: <https://github.com/actions/setup-node>
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: package.json
- name: pnpm install
run: pnpm install --frozen-lockfile
- name: pnpm build frontend
run: pnpm -r build
- name: Dry-run release
id: dry-run
run: python ./release.py ${{ github.ref }}
publish:
needs:
- dry-run
name: Publish to npmjs 📦
runs-on: ubuntu-latest
environment:
name: npmjs
url: https://npmjs.com/package/${{ needs.dry-run.outputs.package }}
permissions:
# <https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions>
id-token: write # pnpm provenance
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
# see: <https://github.com/pnpm/action-setup>
- name: Install pnpm
uses: pnpm/action-setup@v4
# see: <https://github.com/actions/setup-node>
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: package.json
# issue: <https://github.com/pnpm/pnpm/issues/3141#issuecomment-1305563972>
registry-url: https://registry.npmjs.org
- name: pnpm install
run: pnpm install --frozen-lockfile
- name: pnpm build frontend
run: pnpm -r build
- name: release
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
# issue: <https://github.com/pnpm/pnpm/issues/6607#issuecomment-2075092418>
NPM_CONFIG_PROVENANCE: true
run: python ./release.py --no-dry-run ${{ github.ref }}
github-release:
needs:
- publish
name: Create GitHub release 🏷️
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for creating release
steps:
# TODO, FIXME: `pnpm pack` dont support workspaces for now,
# so we cant store the .tgz file for now.
# see: <https://github.com/pnpm/pnpm/issues/4351>
- name: Create release
uses: ncipollo/release-action@v1
with:
draft: true
body: ${{ github.event.head_commit.message }}