Update Status Data #3219
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: Update Status Data | |
| on: | |
| schedule: | |
| - cron: "*/5 * * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: update-and-deploy | |
| cancel-in-progress: true | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: pip install psycopg2-binary | |
| - name: Generate status data from DB | |
| env: | |
| PGSQL_HOST: ${{ secrets.PGSQL_HOST }} | |
| PGSQL_PORT: ${{ secrets.PGSQL_PORT }} | |
| PGSQL_USER: ${{ secrets.PGSQL_USER }} | |
| PGSQL_PASSWORD: ${{ secrets.PGSQL_PASSWORD }} | |
| PGSQL_DATABASE: acedatacloud_platform | |
| run: python scripts/generate_status.py | |
| - name: Commit & push if changed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add data/ | |
| if git diff --cached --quiet; then | |
| echo "No data changes, skip commit" | |
| else | |
| git pull --rebase origin main || true | |
| git commit -m "chore: update status data" | |
| git push | |
| fi | |
| deploy: | |
| needs: update | |
| if: always() && needs.update.result == 'success' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: . | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |