name: Deploy to GitHub Pages on: push: branches: [main] schedule: - cron: "0 4 * * *" workflow_dispatch: permissions: contents: read pages: write id-token: write concurrency: group: pages cancel-in-progress: false jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: 20 cache: npm - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.x" - name: Install frontend dependencies run: npm ci - name: Install Python dependencies run: pip install requests tqdm - name: Update player stats env: STATS_BASE_URL: ${{ secrets.STATS_BASE_URL }} STATS_USER: ${{ secrets.STATS_USER }} STATS_PASS: ${{ secrets.STATS_PASS }} run: python scripts/statsprocess.py - name: Build site run: npm run build - name: Upload Pages artifact uses: actions/upload-pages-artifact@v3 with: path: ./dist deploy: needs: build runs-on: ubuntu-latest environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 notify-indexnow: needs: deploy runs-on: ubuntu-latest if: success() steps: - name: Submit URLs to IndexNow env: INDEXNOW_KEY: ${{ secrets.INDEXNOW_KEY }} run: | if [ -z "$INDEXNOW_KEY" ]; then echo "INDEXNOW_KEY not set, skipping." exit 0 fi HOST="bailuyuan.lunadeer.cn" curl -s -X POST "https://api.indexnow.org/indexnow" \ -H "Content-Type: application/json" \ -d "{ \"host\": \"${HOST}\", \"key\": \"${INDEXNOW_KEY}\", \"keyLocation\": \"https://${HOST}/${INDEXNOW_KEY}.txt\", \"urlList\": [ \"https://${HOST}/\" ] }" echo "" echo "IndexNow notification sent."