Deploy to surge #4
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
# Simple workflow for deploying static content to GitHub Pages | |
name: Main | |
on: push | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
node-version-file: ".nvmrc" | |
- name: Install | |
run: npm ci --prefer-offline --no-audit | |
- name: Lint | |
run: npm run lint | |
- name: Unit test | |
run: npm test | |
- name: Build | |
run: npm run build | |
deploy: | |
needs: test | |
if: github.ref_name == 'master' | |
concurrency: production | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
url: ${{ vars.SURGE_DOMAIN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
node-version-file: ".nvmrc" | |
- name: Install | |
run: npm install --prefer-offline --no-audit | |
- name: Build | |
run: npm run build | |
- name: Deploy | |
run: npx surge ./dist ${{ vars.SURGE_DOMAIN }} --token ${{ secrets.SURGE_TOKEN }} |