diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index f812f3f..a157e76 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -9,6 +9,10 @@ on: jobs: Generate-Pages: runs-on: ubuntu-latest + + permissions: + contents: write + steps: - name: Checkout uses: actions/checkout@v4 @@ -20,23 +24,21 @@ jobs: run: npm install - name: Generate pages run: hexo generate - - name: Upload generated pages - uses: actions/upload-artifact@v4 + - name: Copy pages + run: cp -r public/* ../pages + - name: Checkout to `publish` branch + run: 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 + use: https://github.com/stefanzweifel/git-auto-commit-action@v5 with: - name: generated-pages-${{ github.run_id }} - path: public - if-no-files-found: error - overwrite: true - include-hidden-files: true - compression-level: 5 - - Deploy-Pages: - runs-on: nas-host - steps: - - name: Remove old pages - run: rm -rf ${{ env.PAGE_ROOT }}/* - - name: Download generated pages - uses: actions/download-artifact@v4 - with: - name: generated-pages-${{ github.run_id }} - path: ${{ env.PAGE_ROOT }} + 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