Skip to content

CI

CI #1465

Workflow file for this run

name: CI
on:
push:
branches: master
pull_request:
branches: master
schedule:
# workwaround for cannot set timezone, cron will start on Asia/Taipei 02:00
- cron: "0 18 * * *"
workflow_dispatch:
inputs:
deploy:
description: 'Whether to deploy to gh-pages branch'
required: true
default: '0'
env:
TZ: Asia/Taipei
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Build
run: ./generate.sh
- name: Deploy
if: ${{ github.event_name == 'schedule' || github.event.inputs.deploy == '1' }}
run: |
# update gh-pages
git clone https://github.com/${{ github.repository }}.git gh-pages -b gh-pages --depth 1 --single-branch
cp -rf dist/* gh-pages
# push to gh-pages
cd gh-pages
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add .
git commit -m "$(date '+%Y-%m-%d %H:%M:%S')" || true
git push https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git gh-pages