Skip to content

CI/CD

CI/CD #1940

Workflow file for this run

name: CI/CD
on:
push:
schedule:
- cron: 0 0 * * *
jobs:
events:
name: Events
runs-on: ubuntu-latest
defaults:
run:
working-directory: events
timeout-minutes: 20
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Install dependencies
run: npm install
- name: Fetch events
run: node app.js
env:
AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }}
- name: Store events artifact
uses: actions/upload-artifact@v2
with:
name: events
path: events/output.html
- name: Health check
if: always()
uses: ./.github/actions/healthchecks
with:
status: ${{ job.status }}
url: ${{ secrets.HEALTH_CHECK_URL__NIGHTLY_EVENTS }}
build:
name: Deploy
runs-on: ubuntu-latest
timeout-minutes: 20
needs:
- events
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: GitHub Package Registry login
run: echo ${{ secrets.GITHUB_PACKAGE_REGISTRY_TOKEN }} | docker login --username=tedmiston --password-stdin docker.pkg.github.com
- name: GitHub Package Registry pull
run: >
docker pull docker.pkg.github.com/tedmiston/qcbrunch/hadolint:2d6321a68ac110d14283b89be69e57a9f3b2e616 &&
docker pull docker.pkg.github.com/tedmiston/qcbrunch/html-validator:2d6321a68ac110d14283b89be69e57a9f3b2e616 &&
docker pull docker.pkg.github.com/tedmiston/qcbrunch/js-validator:2d6321a68ac110d14283b89be69e57a9f3b2e616
- name: Validate Dockerfiles
uses: ./.github/actions/hadolint
- name: Load events artifact
uses: actions/download-artifact@v2
with:
name: events
path: /home/runner/work/qcbrunch/qcbrunch/events
- name: Build site
uses: docker://python:3.8.13-slim@sha256:726098870bb14355cb12572764a3be191b42f8b15947d97affe3b8ec6a7a446e
env:
QCBRUNCH_ROOT: $GITHUB_WORKSPACE
with:
entrypoint: bash
args: -c ./docker/qcbrunch-cli/app.sh
- name: Validate HTML
uses: ./.github/actions/html-validator
# todo: debug why image isn't pull stopped working
# - name: Validate CSS
# uses: docker://validator/validator:latest@sha256:33dd5741e96e2369398046fbdce3111d08e3b15e7fc12235655667eacc5d67d3
# with:
# args: /vnu-runtime-image/bin/vnu --skip-non-css --verbose build/css/
- name: Validate JS
uses: ./.github/actions/js-validator
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Validate Markdown
run: >
sudo npm install -g markdownlint-cli &&
markdownlint --ignore=_posts/ --ignore=node_modules/ .
- name: Install Vercel
run: sudo rm /usr/local/bin/vercel && sudo npm install --location=global vercel --unsafe-perm=true --allow-root
- name: Deploy Dev
# if: github.ref != 'refs/heads/master' || github.event_name == 'schedule'
run: make deploy-dev
env:
ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }}
- name: Deploy Prod
if: github.ref == 'refs/heads/master' || github.event_name == 'schedule'
run: make deploy-prod
env:
ZEIT_TOKEN: ${{ secrets.ZEIT_TOKEN }}
- name: GitHub Package Registry logout
if: always()
run: docker logout docker.pkg.github.com
- name: Health check
if: always()
uses: ./.github/actions/healthchecks
with:
status: ${{ job.status }}
url: ${{ secrets.HEALTH_CHECK_URL__NIGHTLY_BUILD }}