1
0
mirror of https://github.com/one-among-us/data.git synced 2024-11-30 06:56:51 +08:00
one-among-us-data/.github/workflows/generator.yml

48 lines
1.3 KiB
YAML
Raw Normal View History

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
2022-08-30 21:52:20 +08:00
uses: actions/checkout@v3
2022-03-21 00:53:16 +08:00
- name: Setup Node
2022-08-30 21:52:20 +08:00
uses: actions/setup-node@v3
2021-11-13 02:56:41 +08:00
with:
2022-08-30 21:52:20 +08:00
# Upgrading to 16.17.0 result in ERR_LOADER_CHAIN_INCOMPLETE issue.
node-version: 16.16.0
2022-03-21 00:53:16 +08:00
- name: Cache node_modules
2022-08-30 21:52:20 +08:00
uses: actions/cache@v3
2022-03-21 00:53:16 +08:00
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-
2022-08-30 21:52:20 +08:00
2022-03-21 00:53:16 +08:00
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --production --frozen-lockfile
2022-08-30 21:52:20 +08:00
2022-03-21 00:53:16 +08:00
- name: Build
run: yarn build
2022-08-30 21:52:20 +08:00
2022-03-21 00:53:16 +08:00
- name: Deploy
run: |
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