From 25cd3c27a0cc5c7524d741a266e830f2bb8c3d4a Mon Sep 17 00:00:00 2001 From: JiJi Date: Thu, 8 Jun 2023 14:58:45 +0800 Subject: [PATCH] Create auto-update.yml --- workflows-demo/auto-update.yml | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 workflows-demo/auto-update.yml diff --git a/workflows-demo/auto-update.yml b/workflows-demo/auto-update.yml new file mode 100644 index 0000000..d063997 --- /dev/null +++ b/workflows-demo/auto-update.yml @@ -0,0 +1,47 @@ +name: Auto update +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' # Every day + +jobs: + meta: + name: Update meta + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: main + + - name: Do meta update + shell: bash + run: | + npm install + npx hexo bangumis -u || echo + + - name: Commit files + run: | + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add . + git commit -m "Update meta on $(date '+%Y-%m-%d %H:%M:%S')" || echo + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} + + - name: Do build + shell: bash + run: | + npm run build + + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@releases/v3 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages # The branch the action should deploy to. + FOLDER: public # The folder the action should deploy. \ No newline at end of file