File tree Expand file tree Collapse file tree 4 files changed +64
-73
lines changed Expand file tree Collapse file tree 4 files changed +64
-73
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ name : Release
2
+
3
+ on :
4
+ # This job runs when a new release is published
5
+ release :
6
+ types : [published]
7
+
8
+ jobs :
9
+
10
+ publish :
11
+ name : Publish to NPM
12
+ runs-on : ubuntu-latest
13
+ env :
14
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
15
+ steps :
16
+ - name : Checkout repository
17
+ uses : actions/checkout@v4
18
+
19
+ - name : Retrieve dependencies from cache
20
+ uses : actions/cache@v4
21
+ id : cacheNpm
22
+ with :
23
+ path : |
24
+ ~/.npm
25
+ node_modules
26
+ key : npm-v22-${{ runner.os }}-refs/heads/main-${{ hashFiles('package.json') }}
27
+
28
+ - name : Install Node.js and npm
29
+ uses : actions/setup-node@v4
30
+ with :
31
+ node-version : 22.x
32
+ registry-url : https://registry.npmjs.org
33
+
34
+ # Normally we have a guarantee that deps are already there, still it may not be the case when:
35
+ # - `main` build for same commit failed (and we still pushed tag manually)
36
+ # - We've pushed tag manually before `main` build finalized
37
+ - name : Install dependencies
38
+ if : steps.cacheNpm.outputs.cache-hit != 'true'
39
+ run : |
40
+ npm update --no-save
41
+ npm update --save-dev --no-save
42
+
43
+ # Store the name of the release
44
+ # See https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
45
+ - run : echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
46
+
47
+ - run : npm version $RELEASE_VERSION --no-git-tag-version
48
+
49
+ - name : Publish new version
50
+ # Note: Setting NODE_AUTH_TOKEN as job|workspace wide env var won't work
51
+ # as it appears actions/setup-node sets own value
52
+ env :
53
+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
54
+ run : npm publish --access public --tag=latest
Original file line number Diff line number Diff line change 1
- # PR's only
2
-
3
- name : Validate
1
+ name : Tests
4
2
5
3
on :
4
+ push :
6
5
pull_request :
7
- branches : [main]
8
6
9
7
env :
10
8
FORCE_COLOR : 1
11
9
12
10
jobs :
13
11
linuxNode16 :
14
- name : ' [Linux] Node.js 16: Unit tests '
12
+ name : ' [Linux] [ Node 16] Tests '
15
13
runs-on : ubuntu-latest
16
14
steps :
17
15
- name : Checkout repository
25
23
~/.npm
26
24
node_modules
27
25
key : npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
28
- restore-keys : |
29
- npm-v16-${{ runner.os }}-${{ github.ref }}-
30
- npm-v16-${{ runner.os }}-refs/heads/main-
26
+ restore-keys : npm-v16-${{ runner.os }}-${{ github.ref }}-
31
27
32
28
- name : Install Node.js and npm
33
29
uses : actions/setup-node@v1
Original file line number Diff line number Diff line change
1
+ /.github
2
+ /.editorconfig
3
+ /.prettierignore
4
+ /prettier.config.js
5
+ /scripts /pkg
6
+ /test
You can’t perform that action at this time.
0 commit comments