Skip to content
35 linesCodeBlameRaw
1name: Build
2on:
3 push:
4 branches: [main]
5 workflow_dispatch:
6jobs:
7 build:
8 runs-on: ubuntu-latest
9 steps:
10 - uses: actions/checkout@v7
11 - name: Restore the cache
12 id: cache
13 uses: actions/cache@v6
14 with:
15 path: .deps
16 key: deps-${{ hashFiles('math.js') }}
17 restore-keys: deps-
18 - name: Fill the cache on a miss
19 if: steps.cache.outputs.cache-hit != 'true'
20 run: mkdir -p .deps && date > .deps/made-at && echo "cache was cold"
21 - run: echo "cache hit=${{ steps.cache.outputs.cache-hit }}; deps made at $(cat .deps/made-at)"
22 - run: mkdir -p dist && cp math.js dist/ && echo "built $(date)" > dist/BUILD
23 - uses: actions/upload-artifact@v7
24 with:
25 name: dist
26 path: dist/
27 verify:
28 needs: build
29 runs-on: ubuntu-latest
30 steps:
31 - uses: actions/download-artifact@v8
32 with:
33 name: dist
34 path: out
35 - run: ls -la out && cat out/BUILD && node -e "console.log(require('./out/math.js').add(2, 2))"