status-update #104
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: Deploy Docs | |
| on: | |
| push: | |
| branches: [main] | |
| schedule: | |
| - cron: "0 */6 * * *" # Every 6 hours | |
| workflow_dispatch: | |
| repository_dispatch: | |
| types: [status-update] | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: daemonless-io | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: daemonless/dbuild | |
| path: dbuild | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Install dependencies | |
| run: | | |
| cd daemonless-io | |
| pip install -r requirements.txt | |
| - name: Fetch repositories | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| cd daemonless-io | |
| make fetch | |
| - name: Generate documentation | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| cd daemonless-io | |
| make generate | |
| - name: Commit generated changes | |
| run: | | |
| cd daemonless-io | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add mkdocs.yaml | |
| git diff --staged --quiet || git commit -m "Update generated docs and status [skip ci]" | |
| git push | |
| - name: Build site | |
| run: | | |
| cd daemonless-io | |
| make build | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: daemonless-io/site/ | |
| 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 | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Notify Discord on outdated images | |
| env: | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_VERSION_WEBHOOK }} | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set +e | |
| python3 scripts/compare-versions.py > /tmp/versions.json 2>/dev/null | |
| EXIT=$? | |
| set -e | |
| if [ $EXIT -eq 0 ] || [ -z "$DISCORD_WEBHOOK" ] || [ ! -s /tmp/versions.json ]; then | |
| exit 0 | |
| fi | |
| COUNT=$(jq '.summary.outdated_count // 0' /tmp/versions.json) | |
| if [ "$COUNT" -eq 0 ]; then | |
| exit 0 | |
| fi | |
| DESCRIPTION=$(jq -r ' | |
| .outdated[] as $item | | |
| (.base_names[$item.name] // $item.name) as $base | | |
| "**[\($item.name)](https://daemonless.io/images/\($item.name))**: " + | |
| ($item.updates | map( | |
| "[\(.tag)](https://github.com/daemonless/\($base)/actions/workflows/build.yaml) `\(.deployed) → \(.available)`" | |
| ) | join(", ")) | |
| ' /tmp/versions.json | awk '{printf "%s\\n", $0}') | |
| curl -s -X POST "$DISCORD_WEBHOOK" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$(jq -n \ | |
| --arg desc "$DESCRIPTION" \ | |
| --arg count "$COUNT" \ | |
| '{embeds: [{title: "🔄 \($count) outdated image(s)", description: $desc, color: 16744272}]}')" | |
| - name: Ping IndexNow | |
| run: | | |
| curl -s -X POST "https://api.indexnow.org/indexnow" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "host": "daemonless.io", | |
| "key": "9165b253e91b4c86a023f24a2335428b", | |
| "keyLocation": "https://daemonless.io/9165b253e91b4c86a023f24a2335428b.txt", | |
| "urlList": [ | |
| "https://daemonless.io/", | |
| "https://daemonless.io/status/", | |
| "https://daemonless.io/images/", | |
| "https://daemonless.io/guides/quick-start/", | |
| "https://daemonless.io/guides/dbuild/", | |
| "https://daemonless.io/community/", | |
| "https://daemonless.io/philosophy/" | |
| ] | |
| }' |