1+ # This is a composition of lint and test scripts
2+
13name : Test and Release
24
35# Run this job on all pushes and pull requests
46# as well as tags with a semantic version
57on :
6- push :
7- branches :
8- - master
9- tags :
10- # normal versions
11- - " v[0-9]+.[0-9]+.[0-9]+"
12- # pre-releases
13- - " v[0-9]+.[0-9]+.[0-9]+-**"
14- pull_request : {}
8+ push :
9+ branches :
10+ - master
11+ tags :
12+ # normal versions
13+ - " v[0-9]+.[0-9]+.[0-9]+"
14+ # pre-releases
15+ - " v[0-9]+.[0-9]+.[0-9]+-**"
16+ pull_request : {}
17+
18+ permissions :
19+ id-token : write # Required for publishing with OIDC
20+ contents : write # Required for creating releases
1521
1622jobs :
1723 # Performs quick checks before the expensive test runs
1824 check-and-lint :
19- if : contains(github.event.head_commit.message, '[skip ci]') == false
20-
2125 runs-on : ubuntu-latest
2226 strategy :
2327 matrix :
24- node-version : [16.x ]
28+ node-version : [24 ]
2529
2630 steps :
27- - uses : actions/checkout@v3
28- - name : Use Node.js ${{ matrix.node-version }}
29- uses : actions/setup-node@v3
30- with :
31- node-version : ${{ matrix.node-version }}
32- cache : ' npm'
31+ - uses : actions/checkout@v6
32+ - name : Use Node.js ${{ matrix.node-version }}
33+ uses : actions/setup-node@v6
34+ with :
35+ node-version : ${{ matrix.node-version }}
36+ cache : ' npm'
3337
34- - name : Install dependencies
35- run : npm ci
38+ - name : Install dependencies
39+ run : npm ci
3640
37- - name : Lint TypeScript code
38- run : npm run lint
41+ - name : Lint TypeScript code
42+ run : npm run lint
3943
40- - name : Compile TypeScript code
41- run : npm run build
44+ - name : Compile TypeScript code
45+ run : npm run build
4246
4347 # ===================
4448
4549 # Runs unit tests on all supported node versions and OSes
4650 unit-tests :
47- if : contains(github.event.head_commit.message, '[skip ci]') == false
48-
49- runs-on : ${{ matrix.os }}
51+ runs-on : ubuntu-latest
5052 strategy :
5153 matrix :
52- node-version : [12.x, 14.x, 16.x, 18.x]
53- os : [ubuntu-latest]
54+ node-version : [22, 24]
5455
5556 steps :
56- - uses : actions/checkout@v3
57- - name : Use Node.js ${{ matrix.node-version }}
58- uses : actions/setup-node@v3
59- with :
60- node-version : ${{ matrix.node-version }}
61- cache : ' npm'
62-
63- - name : Install dependencies
64- run : npm ci
65-
66- - name : Run component tests
67- run : npm run test:ts
68- env :
69- CI : true
57+ - uses : actions/checkout@v6
58+ - name : Use Node.js ${{ matrix.node-version }}
59+ uses : actions/setup-node@v6
60+ with :
61+ node-version : ${{ matrix.node-version }}
62+ cache : ' npm'
63+
64+ - name : Install dependencies
65+ run : npm ci
66+
67+ - name : Run component tests
68+ # Some tests are flaky, try them 3 times if necessary
69+ run : npm run test:ts || npm run test:ts || npm run test:ts
70+ env :
71+ CI : true
7072
7173 # ===================
7274
7375 # Deploys the final package to NPM
7476 deploy :
7577 # Trigger this step only when a commit on master is tagged with a version number
7678 if : |
77- contains(github.event.head_commit.message, '[skip ci]') == false &&
7879 github.event_name == 'push' &&
7980 startsWith(github.ref, 'refs/tags/v')
8081
@@ -83,51 +84,51 @@ jobs:
8384 runs-on : ubuntu-latest
8485 strategy :
8586 matrix :
86- node-version : [16.x ]
87+ node-version : [24 ]
8788
8889 steps :
89- - name : Checkout code
90- uses : actions/checkout@v3
91-
92- - name : Use Node.js ${{ matrix.node-version }}
93- uses : actions/setup-node@v3
94- with :
95- node-version : ${{ matrix.node-version }}
96- cache : ' npm'
97-
98- - name : Extract the version and commit body from the tag
99- id : extract_release
100- # The body may be multiline, therefore we need to escape some characters
101- run : |
102- VERSION="${{ github.ref }}"
103- VERSION=${VERSION##*/v}
104- echo "::set-output name= VERSION:: $VERSION"
105- BODY =$(git show -s --format=%b )
106- BODY="${BODY//'%'/'%25'}"
107- BODY="${ BODY//$'\n'/'%0A'}"
108- BODY="${ BODY//$'\r'/'%0D'}"
109- echo "::set-output name=BODY::$BODY"
110-
111- - name : Install dependencies
112- run : npm ci
113-
114- - name : Create a clean build
115- run : npm run build
116-
117- - name : Publish package to npm
118- run : |
119- npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
120- npm whoami
121- npm publish
122-
123- - name : Create Github Release
124- uses : actions/create- release@v1
125- env :
126- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
127- with :
128- tag_name : ${{ github.ref }}
129- release_name : Release v${{ steps.extract_release.outputs.VERSION }}
130- draft : false
131- # Prerelease versions create prereleases on Github
132- prerelease : ${{ contains(steps.extract_release.outputs.VERSION, '-') }}
133- body : ${{ steps.extract_release.outputs.BODY }}
90+ - name : Checkout code
91+ uses : actions/checkout@v6
92+
93+ - name : Use Node.js ${{ matrix.node-version }}
94+ uses : actions/setup-node@v6
95+ with :
96+ node-version : ${{ matrix.node-version }}
97+ cache : ' npm'
98+
99+ - name : Extract the version and commit body from the tag
100+ id : extract_release
101+ # The body may be multiline, therefore we need to escape some characters
102+ run : |
103+ VERSION="${{ github.ref }}"
104+ VERSION=${VERSION##*/v}
105+ echo "VERSION= $VERSION" >> $GITHUB_OUTPUT
106+ EOF =$(od -An -N6 -x /dev/urandom | tr -d ' ' )
107+ BODY=$(git show -s --format=%b)
108+ echo " BODY<<$EOF" >> $GITHUB_OUTPUT
109+ echo "$ BODY" >> $GITHUB_OUTPUT
110+ echo "$EOF" >> $GITHUB_OUTPUT
111+ if [[ $VERSION == *"-"* ]] ; then
112+ echo "TAG=--tag next" >> $GITHUB_OUTPUT
113+ fi
114+
115+ - name : Install dependencies
116+ run : npm ci
117+
118+ - name : Create a clean build
119+ run : npm run build
120+
121+ - name : Publish package to npm
122+ run : npm publish ${{ steps.extract_release.outputs.TAG }}
123+
124+ - name : Create Github Release
125+ uses : softprops/action-gh- release@v2
126+ env :
127+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
128+ with :
129+ tag_name : ${{ github.ref }}
130+ name : Release v${{ steps.extract_release.outputs.VERSION }}
131+ draft : false
132+ # Prerelease versions create prereleases on Github
133+ prerelease : ${{ contains(steps.extract_release.outputs.VERSION, '-') }}
134+ body : ${{ steps.extract_release.outputs.BODY }}
0 commit comments