generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (68 loc) · 1.89 KB
/
node_build.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
64
65
66
67
68
69
70
71
name: Build and test node
on:
workflow_call:
inputs:
node_version_file:
description: "Passed to setup-node action to specify where to source the version of node from"
required: false
type: string
default: ".nvmrc"
permissions:
contents: read
jobs:
node-build:
name: Run the node build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ inputs.node_version_file }}
uses: actions/setup-node@v4
with:
node-version-file: ${{ inputs.node_version_file }}
- name: update npm
shell: bash
run: |
sudo npm install -g npm@latest
- name: restore cache
id: restore-cache
uses: actions/cache/restore@v4
env:
cache-name: node-modules
with:
path: |
./node_modules
~/.cache/Cypress
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: install dependencies
if: steps.restore-cache.outputs.cache-hit != 'true'
shell: bash
run: |
npm ci --no-audit
- name: build npm
shell: bash
run: |
npm run build
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Linter check # Run linter after build because the integration test code depend on compiled typescript...
shell: bash
run: |
npm run lint
- name: upload the artifacts
uses: actions/upload-artifact@v4
with:
name: npm_build_artifacts
path: |
build/
dist/
assets/stylesheets/
- name: save cache
id: save-cache
uses: actions/cache/save@v4
env:
cache-name: node-modules
with:
path: |
./node_modules
~/.cache/Cypress
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}