WebUI Build and Sync (Weekly, UTC) #1
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: "WebUI Build and Sync (Weekly, UTC)" | |
on: | |
schedule: | |
- cron: '0 0 * * 0' | |
workflow_dispatch: | |
jobs: | |
sync-webui: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout WebUI repo | |
uses: actions/checkout@v2 | |
with: | |
ref: beta | |
repository: DoroWolf/akari-bot-webui | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Node.js and install dependencies | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- run: | | |
npm install | |
npm run build | |
- name: Move dist to webui | |
run: | | |
mv dist webui | |
- name: Checkout Repo | |
uses: actions/checkout@v2 | |
with: | |
repository: Teahouse-Studios/akari-bot | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: akari-bot | |
# 第五步:复制webui到仓库B的根目录 | |
- name: Copy webui to akari-bot | |
run: | | |
cp -r webui akari-bot/ | |
# 第六步:检查是否有变化 | |
- name: Check for changes | |
run: | | |
cd akari-bot | |
git diff --exit-code || echo "Changes detected" | |
# 第七步:如果有变化,提交并推送 | |
- name: Commit and push changes | |
run: | | |
cd akari-bot | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git add . | |
git diff --quiet || (git commit -m "Sync WebUI [skip ci]" && git push) |