-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (67 loc) · 2.23 KB
/
Copy pathpublish.yml
File metadata and controls
83 lines (67 loc) · 2.23 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Release
on:
# This job runs when a new release is published
release:
types: [published]
permissions:
contents: read
id-token: write # Required for OIDC
jobs:
prePublishPackageTest:
name: Prepublish package test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Restore npm cache
uses: actions/cache@v5
with:
path: ~/.npm
key: npm-no-lock-v1-${{ runner.os }}-node24-${{ hashFiles('package.json') }}
restore-keys: |
npm-no-lock-v1-${{ runner.os }}-node24-
- name: Install Node.js and npm
uses: actions/setup-node@v6
with:
node-version: 24.x
package-manager-cache: false
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: npm install --package-lock=false
# Store the name of the release
# See https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
- run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- run: npm version $RELEASE_VERSION --no-git-tag-version
- name: Unit tests
run: npm test
- name: Verify package contents
run: npm pack --dry-run
- name: Build publish tarball
run: echo "PACKAGE_TGZ=$(npm pack --silent)" >> $GITHUB_ENV
- name: Packed install smoke test
run: node ./scripts/ci/pack-smoke.js
env:
PACKAGE_TGZ: ${{ env.PACKAGE_TGZ }}
- name: Upload tested tarball
uses: actions/upload-artifact@v7
with:
name: npm-package
path: ${{ env.PACKAGE_TGZ }}
if-no-files-found: error
npmPublish:
name: Publish to NPM
needs: prePublishPackageTest
runs-on: ubuntu-latest
steps:
- name: Download tested tarball
uses: actions/download-artifact@v8
with:
name: npm-package
- name: Install Node.js and npm
uses: actions/setup-node@v6
with:
node-version: 24.x
package-manager-cache: false
registry-url: https://registry.npmjs.org
- name: Publish new version
run: npm publish ./*.tgz --access public --tag=latest