Refresh status.json #436
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: Refresh status.json | |
| # Regenerates the website's /status flow document and pushes it to the site | |
| # repo. Triggers: | |
| # - after every image build, smoke-promotion, or ISO (workflow_run) so the | |
| # page reflects Margine's own state changes promptly; | |
| # - daily on a schedule so upstream Bluefin drift (baseDigestMatchesBluefin) | |
| # surfaces even when Margine itself didn't change; | |
| # - manually (workflow_dispatch). | |
| # | |
| # workflow_run only fires for the copy of this file on the default branch. | |
| on: | |
| workflow_run: | |
| workflows: | |
| - "Build Margine image" | |
| - "Smoke-boot published image" | |
| - "Build disk images" | |
| types: [completed] | |
| schedule: | |
| - cron: "17 6 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: status-json | |
| cancel-in-progress: true | |
| jobs: | |
| refresh: | |
| runs-on: ubuntu-latest | |
| # workflow_run "completed" also fires for cancelled/skipped upstream runs | |
| # (superseded merge bursts, smoke-boot's no-new-digest skips). Those carry | |
| # no state change worth refreshing and just spawn a duplicate run that the | |
| # concurrency group cancels — skip them. success AND failure both refresh | |
| # (a failed build IS a status change the page should reflect). | |
| if: >- | |
| github.event_name != 'workflow_run' || | |
| (github.event.workflow_run.conclusion != 'cancelled' && | |
| github.event.workflow_run.conclusion != 'skipped') | |
| steps: | |
| - name: Checkout margine-image (producer scripts) | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 1 | |
| - name: Ensure skopeo + jq | |
| run: | | |
| command -v skopeo >/dev/null 2>&1 || { sudo apt-get update -qq && sudo apt-get install -y -qq skopeo; } | |
| command -v jq >/dev/null 2>&1 || { sudo apt-get update -qq && sudo apt-get install -y -qq jq; } | |
| - name: Login to GHCR | |
| # Authenticated skopeo inspect (5000 req/h vs 100 anonymous) so the | |
| # daily + per-event refreshes don't trip the anonymous GHCR limit. | |
| run: skopeo login ghcr.io -u "${{ github.actor }}" -p "${{ secrets.GITHUB_TOKEN }}" | |
| - name: Generate status.json | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| .github/scripts/build-status-json.sh > /tmp/status.json | |
| echo "--- generated status.json ---" | |
| cat /tmp/status.json | |
| - name: Check SITE_BUMP_TOKEN | |
| id: tok | |
| env: | |
| T: ${{ secrets.SITE_BUMP_TOKEN }} | |
| run: | | |
| if [ -z "$T" ]; then | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| echo "::warning::SITE_BUMP_TOKEN not set — generated status.json but cannot publish it." | |
| else | |
| echo "skip=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Checkout website repo | |
| if: steps.tok.outputs.skip != 'true' | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: daniel-g-carrasco/margine-os-1084ca72 | |
| token: ${{ secrets.SITE_BUMP_TOKEN }} | |
| path: site | |
| fetch-depth: 1 | |
| - name: Publish status.json to the site | |
| if: steps.tok.outputs.skip != 'true' | |
| working-directory: site | |
| run: ../.github/scripts/publish-status-json.sh /tmp/status.json |