forked from ipfs/ipfs-webui
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (41 loc) · 1.66 KB
/
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
on:
workflow_call:
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18.14.0
cache: 'npm'
# Separate cache for build dir, we reuse it in release publish workflow
- name: Cache build output
uses: actions/cache@v4
id: build-cache
with:
path: build
# Build hash should be based on runner.os, src files, and dependencies used.
key: ${{ runner.os }}-build-${{ hashFiles('package.json', 'package-lock.json', 'public', 'src/**', '*.js', '*.ts') }}
restore-keys: |
${{ runner.os }}-build-${{ hashFiles('package.json', 'package-lock.json', 'public', 'src/**', '*.js', '*.ts') }}
- name: Install dependencies
# We only need to install deps if build isn't cached.
if: steps.build-cache.outputs.cache-hit != 'true'
run: npm ci --prefer-offline --no-audit --progress=false
- name: Confirm build works
if: steps.build-cache.outputs.cache-hit != 'true'
run: npm run build
# Persist produced build dir:
# - this is not for releases, but for quick testing during the dev
# - action artifacts can be downloaded for 90 days, then are removed by github
- name: Attach produced build to Github Action
# only re-upload if we re-built
if: steps.build-cache.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v3
with:
name: ipfs-webui_${{ github.sha }}-${{ runner.os }}-build
path: build
if-no-files-found: error