refactor: cleanup and upgrade dependencies #12
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 | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- '!**' # Don't run twice on commits with tags | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Lint, test and build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Cache Node Modules | |
id: npm-cache | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-npm- | |
- name: Install Dependencies | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Check Vulnerabilities | |
run: npm audit | |
- name: Lint | |
run: npm run lint | |
- name: Build | |
run: npm run build | |
- name: Fix permissions | |
if: github.ref == 'refs/heads/main' | |
run: chmod -R +rX "dist" | |
- name: Upload Pages artifact | |
if: github.ref == 'refs/heads/main' | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'dist' | |
deploy: | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |