构建 Sub-Store 前端 #293
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: 构建 Sub-Store 前端 | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
paths-ignore: | |
- 'backend' | |
- 'README.md' | |
schedule: | |
- cron: "0 1 */3 * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- name: Install and Build | |
run: | | |
cd .. | |
git clone -b mod https://github.com/SaintWe/Sub-Store-Front-End.git | |
cd Sub-Store-Front-End | |
pnpm install | |
pnpm run build | |
rm -rf "$GITHUB_WORKSPACE/dist" | |
cp -r ./dist "$GITHUB_WORKSPACE/" | |
- name: Verify Changed files | |
uses: tj-actions/verify-changed-files@v12 | |
id: verify-changed-files | |
with: | |
files: | | |
dist | |
- name: Update dist folder to repository | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GIT_ACTIONS_TOKEN }} | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
git add . | |
git commit -m "GitHub Actions Auto Builder at $(date +'%Y-%m-%d %H:%M:%S')" | |
git push --quiet "https://[email protected]/$GITHUB_REPOSITORY.git" main:main |