2021-11-13 03:05:05 +08:00
|
|
|
name: Generator
|
2021-11-13 02:56:41 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ main ]
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2022-03-21 00:53:16 +08:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v2
|
2021-11-13 02:56:41 +08:00
|
|
|
with:
|
2022-03-21 00:53:16 +08:00
|
|
|
node-version: 16.x
|
|
|
|
- name: Cache node_modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: cache
|
2021-11-13 03:05:05 +08:00
|
|
|
with:
|
2022-03-21 00:53:16 +08:00
|
|
|
path: node_modules
|
|
|
|
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock') }}
|
|
|
|
restore-keys: ${{ runner.os }}-node-
|
|
|
|
- name: Install Dependencies
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
run: yarn install --production --frozen-lockfile
|
|
|
|
- name: Build
|
|
|
|
run: yarn build
|
|
|
|
- name: Deploy
|
|
|
|
run: |
|
2022-06-25 02:49:14 +08:00
|
|
|
git config --global user.name "$(git show -s --format='%an' HEAD)"
|
|
|
|
git config --global user.email "$(git show -s --format='%ae' HEAD)"
|
2021-11-13 03:05:05 +08:00
|
|
|
|
2022-03-21 00:53:16 +08:00
|
|
|
cd dist
|
|
|
|
git init
|
|
|
|
git add .
|
|
|
|
git commit -m "Build on $(date '+%Y-%m-%d %H:%M:%S')"
|
|
|
|
git branch -m gh-pages
|
|
|
|
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
|
|
|
|
git push -f origin gh-pages
|