CD #1252
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: CD | |
on: | |
push: | |
branches: | |
- production | |
schedule: | |
# Translate the cron schedule into human-readable format: https://crontab.guru/ | |
# every day at midnight | |
- cron: '0 0 * * *' | |
jobs: | |
cd: | |
runs-on: macos-latest # for the fonts in the OG image | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: production | |
- name: Setup node env | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile --network-timeout 100000 | |
- name: Run linter | |
run: yarn run lint | |
- name: Build | |
run: yarn run build | |
- name: Push to dev & production branch | |
run: | | |
if [ -n "$(git diff --exit-code)" ] | |
then | |
git config user.name github-actions | |
git config user.email [email protected] | |
git fetch origin dev | |
git stash | |
git checkout dev | |
git stash pop | |
git add -A | |
git commit -m "feat: update the OG images & og-imgs-cache.json" | |
git push origin dev | |
git checkout production | |
git cherry-pick dev@{0} | |
git push origin production | |
fi | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist | |
cname: about.disfactory.tw |