Skip to content

Build and Deploy

Build and Deploy #426

Workflow file for this run

name: Build and Deploy
on:
push:
branches: [ main ]
pull_request:
types: [opened, synchronize, reopened]
schedule:
- cron: '0 11 * * *'
workflow_dispatch:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
S3_BUCKET: "${{ secrets.S3_BUCKET }}"
CLOUDFRONT_ID: ${{ secrets.CLOUDFRONT_ID }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 19.x
uses: actions/setup-node@v3
with:
node-version: 19.x
cache: 'npm'
- uses: jongwooo/next-cache@v1
- run: npm ci
- run: npm run build
- name: Archive site as artifact
uses: actions/upload-artifact@v1
with:
name: out
path: out
- name: Archive s3_website.yml as artifact
uses: actions/upload-artifact@v1
with:
name: s3_website
path: s3_website.yml
deploy:
runs-on: ubuntu-latest
needs: build
if: contains(github.ref, 'main')
steps:
- name: Retrieve site from artifacts
uses: actions/download-artifact@v1
with:
name: out
- name: Retrieve s3_website.yml from artifacts
uses: actions/download-artifact@v1
with:
name: s3_website
- name: Move s3_website.yml into root
run: |
mv s3_website/s3_website.yml s3_website.yml
- name: S3 Publish
uses: docker://justinharringa/s3_website:master
with:
args: 'push --site out'