Update & Deploy Game Data #25
This file contains 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: Update & Deploy Game Data | |
on: | |
schedule: | |
# UTC time for 10:30 & 16:10 (UTC+8) | |
- cron: "30 2 * * *" | |
- cron: "10 8 * * *" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Global permissions configuration starts here | |
permissions: | |
# 'write' access to repository contents | |
contents: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "update_pages" | |
cancel-in-progress: false | |
jobs: | |
check_update: | |
runs-on: ubuntu-latest | |
outputs: | |
result: ${{ steps.condition.outputs.need_update }} | |
steps: | |
- name: Cehckout root repo firstly. | |
uses: actions/checkout@v4 | |
- name: Preparing job | |
uses: ./.github/actions/prepare-dependences | |
- name: Check if need to update | |
id: check_update | |
run: poetry run python main.py --all --test_update | |
- name: Set Condition | |
id: condition | |
if: ${{ github.event_name != 'schedule' || steps.check_update.outputs.test_update == 'true' }} | |
run: echo "need_update=true" >> "$GITHUB_OUTPUT" | |
update_deploy: | |
permissions: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
pages: write | |
id-token: write | |
needs: check_update | |
if: ${{ needs.check_update.outputs.result == 'true' }} | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Cehckout root repo firstly. | |
uses: actions/checkout@v4 | |
- name: Preparing job | |
uses: ./.github/actions/prepare-dependences | |
- name: Proceed to Update & Commit | |
uses: ./.github/actions/auto-update | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
# Upload docs/website/ directory | |
path: "docs/website/" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |