-
Notifications
You must be signed in to change notification settings - Fork 76
56 lines (53 loc) · 1.55 KB
/
14-artifacts.yaml
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
name: 14 - Working with Artifacts
on:
workflow_dispatch:
env:
build-artifact-key: app-${{ github.sha }}
test-coverage-key: test-coverage-${{ github.sha }}
jobs:
test-build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: 14-artifacts/react-app
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '20.x'
- name: Download cached dependencies
uses: actions/cache@v3
id: cache
with:
path: 14-artifacts/react-app/node_modules
key: deps-node-modules-${{ hashFiles('14-artifacts/react-app/package-lock.json') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
- name: Unit tests
run: npm run test -- --coverage
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: ${{ env.test-coverage-key }}
path: 14-artifacts/react-app/coverage
- name: Build code
run: npm run build
- name: Upload build files
uses: actions/upload-artifact@v3
with:
name: ${{ env.build-artifact-key }}
path: 14-artifacts/react-app/build
deploy:
runs-on: ubuntu-latest
needs: test-build
steps:
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.build-artifact-key }}
path: build
- name: Show folder structure
run: ls -R