14 - Working with Artifacts #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 14 - Working with Artifacts | |
on: | |
workflow_dispatch: | |
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 | |
- name: Build code | |
run: npm run build | |
- name: Upload build files | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app | |
path: 14-artifacts/react-app/build | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: app | |
path: build | |
- name: Show folder structure | |
run: ls -R |