Add Slumber post #104
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: Build and Deploy | |
env: | |
# Should match what's in .nvmrc | |
NODE_VERSION: "16.5.0" | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build: | |
name: Build site | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: npm | |
- name: Cache Dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
${{ github.workspace }}/.next/cache | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]sx?') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | |
- name: Install npm dependencies | |
run: npm install | |
- name: Lint | |
run: npm run lint | |
- name: Build | |
run: npm run build | |
- name: Archive build | |
if: github.ref == 'refs/heads/master' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build | |
path: out | |
deploy: | |
name: Deploy site | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
needs: | |
- build | |
steps: | |
- name: Download build artifact | |
id: download | |
uses: actions/download-artifact@v2 | |
with: | |
name: build | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@3.7.1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: ${{ steps.download.outputs.download-path }} | |
CLEAN: true |