Modular logistics and supply chain operating system (LSOS)
JavaScript driver-appfleet-managementfreight-managementinfrastructureinventory-managementlast-mile-deliverylogisticsondemandopen-sourceorder-managementroute-optimizationsupply-chain-managementtracking-and-monitoringtransport-management-systemtransportationwarehouse-management
ci: notify fleetbase/showcase after each tag's Docker images are published (#696)
Ron0c9545baef9d
diff --git a/.github/workflows/publish-docker-images.yml b/.github/workflows/publish-docker-images.ymlindex 03920eda..1746f437 100644--- a/.github/workflows/publish-docker-images.yml+++ b/.github/workflows/publish-docker-images.yml@@ -1,5 +1,8 @@name: Fleetbase Docker Images+permissions:+ contents: read+on:push:tags:@@ -48,3 +51,46 @@ jobs:fleetbase-apifiles: |./docker-bake.hcl++ # Tell fleetbase/showcase that this tag's images exist, so it can screenshot the release.+ #+ # A job with `needs:` rather than a workflow_run trigger in the other repo: needs gives a real+ # success dependency, so the event fires only after BOTH images are actually pushed, and the+ # tag comes straight from this run instead of workflow_run's indirection. (The existing+ # workflow_run consumers of this workflow do not gate on conclusion and fire on failure too.)+ #+ # Setup: a fine-grained PAT scoped to fleetbase/showcase only, with Contents: read and write+ # (the dispatches endpoint requires write), stored here as SHOWCASE_DISPATCH_TOKEN. Follows the+ # FLEETBASE_IO_DISPATCH_TOKEN precedent in fleetbase/postman — a purpose-scoped token per+ # direction, never the org-wide _GITHUB_AUTH_TOKEN. Publishing never fails because of this+ # job: a missing token is a warning, not an error.+ notify-showcase:+ name: Notify fleetbase/showcase+ needs: docker-release+ runs-on: ubuntu-latest+ if: github.ref_type == 'tag' || github.event.inputs.version != ''+ steps:+ - name: Send repository_dispatch to fleetbase/showcase+ env:+ DISPATCH_TOKEN: ${{ secrets.SHOWCASE_DISPATCH_TOKEN }}+ TAG: ${{ github.event.inputs.version || github.ref_name }}+ SHA: ${{ github.sha }}+ ACTOR: ${{ github.actor }}+ run: |+ if [ -z "$DISPATCH_TOKEN" ]; then+ echo "::warning::SHOWCASE_DISPATCH_TOKEN is not set; fleetbase/showcase was not notified of $TAG."+ exit 0+ fi+ status=$(curl -sS -o /tmp/dispatch.out -w "%{http_code}" \+ -X POST \+ -H "Accept: application/vnd.github+json" \+ -H "Authorization: Bearer $DISPATCH_TOKEN" \+ -H "X-GitHub-Api-Version: 2022-11-28" \+ https://api.github.com/repos/fleetbase/showcase/dispatches \+ -d "{\"event_type\":\"fleetbase-release\",\"client_payload\":{\"tag\":\"$TAG\",\"sha\":\"$SHA\",\"actor\":\"$ACTOR\"}}")+ if [ "$status" != "204" ]; then+ echo "::error::Dispatch to fleetbase/showcase failed (HTTP $status)"+ cat /tmp/dispatch.out+ exit 1+ fi+ echo "Dispatched fleetbase-release ($TAG) to fleetbase/showcase"