Repository navigation
63 lines (50 loc) · 2.15 KB
/
Copy pathpublish.yml
File metadata and controls
63 lines (50 loc) · 2.15 KB
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
name: Publish @doist/react-compiler-tracker package
on:
# triggered by `release-please.yml`
workflow_dispatch:
permissions:
# Enable the use of OIDC for trusted publishing and npm provenance
id-token: write
# Enable the use of GitHub Packages registry
packages: write
# Enable Release Please to publish a GitHub release
contents: read
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Prepare Node.js environment
uses: actions/setup-node@v6
with:
cache: npm
node-version-file: .node-version
- name: Ensure npm 11.5.1 or later is installed
run: npm install -g npm@latest
- name: Install project npm dependencies
run: npm ci
- run: npm run check
- run: npm run test
- run: npm run build
# The Node.js environment is prepared based on the `.npmrc` file in the repo, which
# configures Doist scoped packages to use the public npm registry with OIDC
# authentication for the initial publish, after which we remove the Doist registry
# configuration, and prepare the Node.js environment for the GitHub Packages registry,
# providing a predictable release workflow for both registries.
- name: Publish package to public npm registry
run: npm publish
- name: Remove Doist registry configuration from `.npmrc`
run: npm config delete @doist:registry --location=project
- name: Prepare Node.js environment for GitHub Packages registry
uses: actions/setup-node@v6
with:
cache: npm
node-version-file: .node-version
registry-url: https://npm.pkg.github.com/
scope: '@doist'
- name: Publish package to GitHub Packages registry
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}