Deploy to GitHub Pages #4962
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: Deploy to GitHub Pages | |
| permissions: | |
| contents: write | |
| on: | |
| schedule: | |
| # - cron: "0,30 * * * *" # 在每小时的00分和30分运行 | |
| - cron: "0 0/8 * * *" # 每8小时运行 | |
| workflow_dispatch: # 允许手动触发 | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.12" | |
| - name: Set up Git | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "actions@github.com" | |
| git config --global pull.rebase false | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run config converting script | |
| run: python src/main.py | |
| - name: Checkout Pages repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: cute-omega/cute-omega.github.io | |
| token: ${{ secrets.PAT }} | |
| path: pages-repo | |
| - name: Copy and commit to Pages repo | |
| run: | | |
| mkdir -p pages-repo/other-assets | |
| cp assets/final_config.json pages-repo/other-assets/ds-config.json | |
| cd pages-repo | |
| git checkout master || git checkout -b master | |
| git add other-assets/ds-config.json || true | |
| git commit -m "Update ds-config.json to new location for permanent migration solution" || echo "No changes to commit" | |
| git pull origin master --no-edit | |
| git push origin master |