Fixing build and adding cache. #20
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: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- olt | |
jobs: | |
build: | |
name: 🛠️ Build Frontend Artifact | |
needs: | |
- audit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: Cache Node Modules | |
uses: actions/cache@v3 | |
with: | |
path: frontend/node_modules | |
key: fe-node-${{ hashFiles('frontend/package-lock.json') }} | |
- name: Install deps | |
run: cd frontend && npm i | |
- name: Compile code | |
run: cd frontend && npm run build | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: frontend/build | |
audit: | |
name: 🛡️ Audit Frontend Packages | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check for vulnerabilities | |
run: cd frontend && npm audit --omit=dev | |
lint: | |
name: 🧼 Ensure Code Style | |
needs: audit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: Cache Node Modules | |
uses: actions/cache@v3 | |
with: | |
path: frontend/node_modules | |
key: fe-node-${{ hashFiles('frontend/package-lock.json') }} | |
- name: Install deps | |
run: cd frontend && npm i | |
- name: 😂 Lint code | |
run: cd frontend && npm run lint |