Skip to content

Build And Deploy

Build And Deploy #243

name: Build And Deploy
on:
push:
branches: [main]
workflow_dispatch:
schedule:
- cron: "0 10 */10 * *" # 每10天更新一次
permissions:
contents: write
env:
TZ: Asia/Shanghai
jobs:
build-project:
name: Build And Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set pnpm
uses: pnpm/action-setup@v4
with:
version: 10
run_install: false
- name: Set Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- name: Install dependencies
run: |
pnpm up
pnpm install
- name: Build project
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 .
if ! git diff --staged --quiet; then
git commit -m "Github Action Auto Updated"
git push
fi