Repository navigation
Auto Deploy Report #8079
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: Auto Deploy Report | |
| on: | |
| schedule: | |
| - cron: '*/30 * * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "🔄 Checkout code" | |
| uses: actions/checkout@v4 | |
| - name: "🐹 Set up Go" | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24' | |
| - name: "🔧 Setup environment variables from secrets" | |
| env: | |
| SECRETS_CONTEXT: ${{ toJSON(secrets) }} | |
| run: | | |
| echo "Setting up environment variables from GitHub secrets..." | |
| echo "$SECRETS_CONTEXT" | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> $GITHUB_ENV | |
| echo "Environment variables configured from secrets" | |
| - name: "🏗️ Build and run PongHub" | |
| run: | | |
| mkdir -p bin data | |
| git clone --branch gh-pages https://github.com/${{ github.repository }}.git || true | |
| if [ -f ponghub/ponghub_log.json ]; then | |
| cp ponghub/ponghub_log.json data/ponghub_log.json | |
| else | |
| echo "New installation, no previous data found." | |
| fi | |
| make run || true | |
| - name: "📦 Prepare publish directory" | |
| run: | | |
| mkdir -p publish/static | |
| cp -r data/* publish/ | |
| cp -r static/* publish/static/ | |
| if [ -f CNAME ]; then | |
| cp CNAME publish/ | |
| else | |
| echo "No CNAME file found." | |
| fi | |
| touch publish/.nojekyll | |
| - name: "🚀 Deploy to GitHub Pages" | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: publish | |
| single-commit: true | |
| git-config-name: github-pages-deploy-action | |
| git-config-email: noreply@github.com | |
| - name: "⚠️ Handle Service Notifications" | |
| run: | | |
| if [ -f data/default_enabled.txt ] && [ -s data/default_enabled.txt ] && [ "$(cat data/default_enabled.txt)" = "true" ]; then | |
| if [ -f data/notify.txt ] && [ -s data/notify.txt ]; then | |
| echo "Service issues detected:" | |
| cat data/notify.txt | |
| echo "Default notification enabled, failing workflow." | |
| exit 1 | |
| fi | |
| else | |
| if [ -f data/notify.txt ] && [ -s data/notify.txt ]; then | |
| echo "Service issues detected:" | |
| cat data/notify.txt | |
| echo "Service issues have been reported through the configured notification channels." | |
| else | |
| echo "No service issues detected." | |
| fi | |
| fi |