fix: unable to checkout publish in workflow
This commit is contained in:
parent
415386dc17
commit
0ef8fe1157
48
.gitea/workflows/deploy.yml
Normal file
48
.gitea/workflows/deploy.yml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
name: Deploy Pages
|
||||||
|
run-name: ${{ gitea.event.head_commit.message }}
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Generate-Pages:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '16'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm install
|
||||||
|
- name: Install hexo-cli
|
||||||
|
run: npm install hexo-cli -g
|
||||||
|
- name: Generate pages
|
||||||
|
run: hexo generate
|
||||||
|
- name: Copy pages
|
||||||
|
run: cp -r public ../pages
|
||||||
|
- name: Checkout to `publish` branch
|
||||||
|
run: |
|
||||||
|
git fetch
|
||||||
|
git checkout publish
|
||||||
|
- name: Remove old files
|
||||||
|
run: rm -rf `ls | grep -v .git`
|
||||||
|
- name: Copy new files
|
||||||
|
run: cp -r ../pages/* .
|
||||||
|
- name: Commit and Push back Changes
|
||||||
|
uses: https://github.com/stefanzweifel/git-auto-commit-action@v5
|
||||||
|
with:
|
||||||
|
commit_message: "Auto deploy pages"
|
||||||
|
commit_user_name: "Gitea-Actions[bot]"
|
||||||
|
commit_user_email: "41898282+gitea-actions[bot]@users.noreply.gitea.com"
|
||||||
|
branch: publish
|
||||||
|
commit_options: "--no-verify"
|
||||||
|
- name: Call API to Update Caddy
|
||||||
|
run: curl https://upd.linloir.cn/update/blog.linloir.gitea.linloir.cn
|
||||||
Loading…
x
Reference in New Issue
Block a user