2025 已经过一半了!聊聊最近的生活 #260
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: Sync Post | |
# Controls when the workflow will run | |
on: | |
# schedule: | |
# - cron: "30 1 * * *" | |
# https://docs.github.com/cn/developers/webhooks-and-events/events/issue-event-types | |
issues: | |
types: | |
- opened | |
- closed | |
- edited | |
- renamed | |
- labeled | |
- unlabeled | |
- reopened | |
- committed # 修改? | |
workflow_dispatch: | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
GH_USER: ${{ secrets.GH_USER }} | |
GH_PROJECT_NAME: ${{ secrets.GH_PROJECT_NAME }} | |
jobs: | |
Publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v2 | |
- name: Setup Node.js 🚀 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.11.0' # 指定具体的版本号 | |
- name: Git config 🔧 | |
run: | | |
git config --global user.name "coderPerseus" | |
git config --global user.email "snailrun160@gmail.com" | |
- name: Display runtime info ✨ | |
run: | | |
echo '当前目录:' | |
pwd | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 9.6.0 # 或者您想要使用的 pnpm 版本 | |
- name: Install 🔧 | |
run: pnpm install | |
# - name: Build ⛏️ | |
# run: pnpm run build | |
- name: Update blog files ⛏️ | |
run: | | |
pnpm run sync-post | |
git add . | |
git commit -m 'chore(ci): blog sync' | |
- name: Pull latest changes from remote | |
run: git pull --rebase origin main | |
- name: Push changes to remote | |
run: git push |