Build And Deploy #188
This file contains hidden or 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: Build And Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 */168 * * *" # run every 168 hours | |
| env: | |
| TZ: Asia/Shanghai | |
| jobs: | |
| build-project: | |
| name: Build And Deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| run_install: false | |
| - name: Set Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build project | |
| env: | |
| NODE_OPTIONS: --max_old_space_size=8192 | |
| run: pnpm run build | |
| - name: Check if there are any changes | |
| id: verify_diff | |
| run: git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT | |
| - name: Deploy to vodtv.github.io | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| personal_token: ${{ secrets.PUBLISH_DOCS }} | |
| external_repository: vodtv/vodtv.github.io | |
| publish_dir: .vitepress/dist | |
| publish_branch: gh-pages | |
| cname: vodtv.github.io | |
| - name: Commit project 🐱🏍 | |
| if: steps.verify_diff.outputs.changed == 'true' | |
| run: | | |
| git config --local user.email "28900094+github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "HeFung" | |
| git add . | |
| git commit -m "bing wallpaper project Update: `TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M:%S'`" | |
| - name: Push project 🚀 | |
| if: steps.verify_diff.outputs.changed == 'true' | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: main |