Repository navigation
83 lines (70 loc) · 2.63 KB
/
Copy pathbuild.yml
File metadata and controls
83 lines (70 loc) · 2.63 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
# SPDX-FileCopyrightText: Estonian Information System Authority
# SPDX-License-Identifier: MIT
name: Build extension
on: [push, pull_request]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '20.x'
- name: Cache Node.js modules
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci
- name: Build
run: |
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
export TOKEN_SIGNING_BACKWARDS_COMPATIBILITY=true
npm run test clean build package validate
- name: Generate SBOM
run: |
WEBEXT_VERSION=$(node -p "require('./package.json').version")
WEBEID_JS_VERSION=$(node -p "require('./lib/web-eid.js/package.json').version")
SBOM=web-eid-webextension-${WEBEXT_VERSION}.spdx
npm sbom --sbom-format spdx --package-lock-only > ${SBOM}
jq --arg version "${WEBEID_JS_VERSION}" '
.packages += [{
"SPDXID": "SPDXRef-Package-web-eid.js",
"name": "web-eid.js",
"versionInfo": $version,
"downloadLocation": "https://github.com/web-eid/web-eid.js",
"filesAnalyzed": false,
"licenseConcluded": "MIT",
"licenseDeclared": "MIT",
"copyrightText": "NOASSERTION"
}] |
.relationships += [{
"spdxElementId": "SPDXRef-DOCUMENT",
"relationshipType": "DESCRIBES",
"relatedSpdxElement": "SPDXRef-Package-web-eid.js"
}]
' ${SBOM} > ${SBOM}.tmp && mv ${SBOM}.tmp ${SBOM}
- name: Upload artifacts
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: web-eid-webextension-${{github.run_number}}
path: dist/
- name: Upload SBOM artifacts
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: web-eid-webextension-sbom-${{github.run_number}}
path: "*.spdx"