CI #768
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: CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| schedule: | |
| - cron: "22 21 * * 1-5" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Configure git remote | |
| run: git config --add remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' | |
| - name: Fetch gh-pages branch | |
| run: git fetch origin gh-pages | |
| - name: Checkout gh-pages branch | |
| run: git checkout gh-pages | |
| - name: Copy over generate.sh | |
| run: git checkout master -- generate.sh | |
| - name: Run generate.sh and cleanup | |
| run: | | |
| ./generate.sh | |
| rm generate.sh | |
| - name: Generate commit message from RIR statistics | |
| id: commit_message | |
| run: | | |
| # Extract serial (date) from each RIR statistics file header (skip comment lines starting with #) | |
| APNIC_SERIAL=$(grep -v '^#' delegated-apnic-latest.txt 2>/dev/null | head -1 | cut -d'|' -f3 || echo "N/A") | |
| ARIN_SERIAL=$(grep -v '^#' delegated-arin-extended-latest.txt 2>/dev/null | head -1 | cut -d'|' -f3 || echo "N/A") | |
| RIPENCC_SERIAL=$(grep -v '^#' delegated-ripencc-latest.txt 2>/dev/null | head -1 | cut -d'|' -f3 || echo "N/A") | |
| AFRINIC_SERIAL=$(grep -v '^#' delegated-afrinic-latest.txt 2>/dev/null | head -1 | cut -d'|' -f3 || echo "N/A") | |
| LACNIC_SERIAL=$(grep -v '^#' delegated-lacnic-latest.txt 2>/dev/null | head -1 | cut -d'|' -f3 || echo "N/A") | |
| # Get current UTC time for commit title | |
| UTC_TIME=$(date -u '+%Y-%m-%d %H:%M:%S UTC') | |
| # Create commit message with RIR statistics info | |
| { | |
| echo "message<<COMMIT_MESSAGE_EOF" | |
| echo "${UTC_TIME}" | |
| echo "" | |
| echo "RIR statistics serial numbers:" | |
| echo "- APNIC: ${APNIC_SERIAL}" | |
| echo "- ARIN: ${ARIN_SERIAL}" | |
| echo "- RIPE NCC: ${RIPENCC_SERIAL}" | |
| echo "- AFRINIC: ${AFRINIC_SERIAL}" | |
| echo "- LACNIC: ${LACNIC_SERIAL}" | |
| echo "COMMIT_MESSAGE_EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Generate sha256sums.txt | |
| run: sha256sum -b *.txt > sha256sums.txt | |
| - name: Run restore_last_git_modified_time.sh | |
| run: curl -sL https://gist.github.com/HackingGate/9e8169c7645b074b2f40c959ca20d738/raw/3ae3913f308d9cf34962ac3488b5973a2fbe1a95/restore_last_git_modified_time.sh | sh | |
| - name: Generate index.html | |
| run: | | |
| tree -I 'CNAME' -H '.' -L 1 -h -D --timefmt '%Y-%m-%d %H:%M:%S %Z' --noreport --charset utf-8 -T 'Country IP Blocks' -o index.html | |
| sed -i "/\".\"/d" index.html | |
| cat github-corner.html >> index.html | |
| sed -i "s|your-url|github.com/${{ github.repository }}|g" index.html | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: . | |
| user_name: 'github-actions[bot]' | |
| user_email: 'github-actions[bot]@users.noreply.github.com' | |
| full_commit_message: ${{ steps.commit_message.outputs.message }} |