-
-
Notifications
You must be signed in to change notification settings - Fork 564
63 lines (62 loc) · 1.96 KB
/
ci.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
on:
pull_request: {}
push: {}
jobs:
publish:
needs: ci
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: navikt/github-app-token-generator@v1
id: get-token
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
persist-credentials: false # for later steps to use a different authentication
- uses: actions/setup-node@v4
with:
node-version: latest
- run: npm ci
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ steps.get-token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# The ci-matrix job ends up as multiple jobs and therefore as multiple checks.
# Each check's name ends up with the node version appended.
# If we were to use those checks as required checks, we would have to occasionally bump them.
# This job allows us to have a single check that we don't have to bump.
ci:
needs: ci-matrix
runs-on: ubuntu-latest
steps:
- run: exit 0
ci-matrix:
needs: get-supported-node-versions
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ${{ fromJson(needs.get-supported-node-versions.outputs.versions) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # for commit linting
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm --global install npm@latest
- run: npm ci
- uses: wagoid/commitlint-github-action@v5
- run: npm test
get-supported-node-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: get
run: |
set -euxo pipefail
active_versions=$(bash get-node-supported-versions.sh)
echo "active=$active_versions" >> "$GITHUB_OUTPUT"
outputs:
versions: ${{ steps.get.outputs.active }}