Skip to content

CI

CI #1087

Workflow file for this run

on:
push:
pull_request:
schedule:
- cron: "49 05 * * *" # Daily at 10:49 PM PDT, 10:49 PM PST.
workflow_dispatch:
name: CI
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected]
with:
cancel_others: 'true'
check:
name: Check
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Node packages
run: npm ci
- name: Check
run: npm run check
build:
name: Build
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
timeout-minutes: 10
env:
WWW_DIR: dist
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Node packages
run: npm ci
- name: Install q CLI
run: |
wget -O ./q.deb https://github.com/harelba/q/releases/download/v3.1.6/q-text-as-data-3.1.6-1.x86_64.deb
sudo apt install ./q.deb
- name: Build
env:
_511_KEY: ${{ secrets._511_KEY }}
run: npm run build
- name: Deploy to gh-pages
if: ${{ github.event_name != 'pull_request' }}
shell: bash
run: |
cp -r .github/gh-pages/. "$WWW_DIR/"
git -C "$WWW_DIR" init -q
git -C "$WWW_DIR" remote add origin "$(git remote get-url origin)"
git -C "$WWW_DIR" config credential.helper "$(git config credential.helper)"
git -C "$WWW_DIR" config 'http.https://github.com/.extraheader' "$(git config 'http.https://github.com/.extraheader')"
git -C "$WWW_DIR" config core.autocrlf input
git -C "$WWW_DIR" config core.safecrlf false
git -C "$WWW_DIR" fetch origin gh-pages:gh-pages || true
git -C "$WWW_DIR" symbolic-ref HEAD refs/heads/gh-pages
git -C "$WWW_DIR" reset
git -C "$WWW_DIR" add -A
if git -C "$WWW_DIR" -c 'user.name=github-actions[bot]' -c 'user.email=41898282+github-actions[bot]@users.noreply.github.com' \
commit -m "Build site $(date -I) $(git rev-parse HEAD)";
then
git -C "$WWW_DIR" push -u origin gh-pages --quiet
else
echo 'No changes to commit'
fi
# https://github.com/marketplace/actions/cloudflare-pages-github-action
- name: Deploy to Cloudflare Pages
if: ${{ github.event_name != 'pull_request' }}
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: 7e02b4cfe04874f3be5b4266b005f6ab
projectName: muni-sign
directory: dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}