From 33eb8f69a999db32ecbebfeebb65ce4bccbc5a58 Mon Sep 17 00:00:00 2001 From: Cato <41178744+catomean@users.noreply.github.com> Date: Mon, 26 Oct 2026 20:53:06 +0100 Subject: [PATCH] chore: add the fleet package template files this repo is missing (release-notify.yml) (#17) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Files from bitbaum/fleet `templates/package` that this repository does not have yet: - `.github/workflows/release-notify.yml` Only missing files are added — no file this repository already has is changed. `release.yml` is what lets the package owner release a new version from Loki (the package page: "Release vX.Y.Z"), or from the Actions tab. Opened by bitbaum/fleet `scripts/packages/sync-package-template.mjs` (`.github/workflows/package-repos.yml`). It merges itself when this repository's CI is green. Co-authored-by: bitbaum-fleet --- .github/workflows/release-notify.yml | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/release-notify.yml diff --git a/.github/workflows/release-notify.yml b/.github/workflows/release-notify.yml new file mode 100644 index 0000000..0bbbebd --- /dev/null +++ b/.github/workflows/release-notify.yml @@ -0,0 +1,55 @@ +# A release is useful only when the registry and consumers learn about it. +# No checkout or execution of the completed workflow's code: metadata only. +name: Notify Fleet of verified release + +on: + workflow_run: + workflows: [CI, Release, Publish] + types: [completed] + +permissions: + contents: read + actions: read + +concurrency: + group: release-notify + cancel-in-progress: false + +jobs: + notify: + if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'pull_request' && github.event.workflow_run.head_repository.full_name == github.repository + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Resolve a verified immutable release before requesting reconciliation + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + SHA: ${{ github.event.workflow_run.head_sha }} + FLEET_TOKEN: ${{ secrets.FLEET_PAT }} + shell: bash + run: | + set -euo pipefail + manifest="$(gh api "repos/$GH_REPO/contents/package.json?ref=$SHA" --jq .content | base64 --decode)" + version="$(jq -r .version <<< "$manifest")" + if [[ ! "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then + echo 'No stable version; no reconciliation requested.' + exit 0 + fi + # Source commits with no matching release tag are not releases. + if ! tagged="$(gh api "repos/$GH_REPO/commits/v$version" --jq .sha 2>/dev/null)" || [ "$tagged" != "$SHA" ]; then + echo 'This commit is not the versioned release; no reconciliation requested.' + exit 0 + fi + ci="$(gh api "repos/$GH_REPO/actions/runs?head_sha=$SHA&per_page=100" --jq '[.workflow_runs[] | select(.path == ".github/workflows/ci.yml" and (.event == "push" or .event == "workflow_dispatch"))] | first | .conclusion')" + if [ "$ci" != success ]; then + echo 'Release CI is not successful yet; its completion will retry notification.' + exit 0 + fi + if [ -z "$FLEET_TOKEN" ]; then + echo '::error::FLEET_PAT is required to notify Fleet; scheduled reconciliation remains the fallback.' + exit 1 + fi + payload="$(jq -n --arg repository "$GH_REPO" --arg version "$version" --arg commit "$SHA" '{event_type:"shared-package-release",client_payload:{repository:$repository,version:$version,commit:$commit}}')" + GH_TOKEN="$FLEET_TOKEN" gh api --method POST repos/bitbaum/fleet/dispatches --input - <<< "$payload" + echo "Requested authoritative registry and consumer reconciliation for $GH_REPO v$version ($SHA)." >> "$GITHUB_STEP_SUMMARY"