Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/publish-webapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ on:
image_repo:
description: The image repository the build was published to (without tag)
value: ${{ jobs.publish.outputs.image_repo }}
digest:
description: Multi-arch index digest (sha256:...) of the published image
value: ${{ jobs.publish.outputs.digest }}
secrets:
SENTRY_AUTH_TOKEN:
required: false
Expand All @@ -42,6 +45,7 @@ jobs:
version: ${{ steps.get_tag.outputs.tag }}
short_sha: ${{ steps.get_commit.outputs.sha_short }}
image_repo: ${{ steps.set_tags.outputs.image_repo }}
digest: ${{ steps.build_push.outputs.digest }}
steps:
- name: 🏭 Setup Depot CLI
uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ on:
required: false
SENTRY_AUTH_TOKEN:
required: false
CROSS_REPO_PAT:
required: false
push:
branches:
- main
Expand Down Expand Up @@ -112,3 +114,45 @@ jobs:
uses: ./.github/workflows/trivy-image-webapp.yml
with:
image-ref: ${{ needs.publish-webapp.outputs.image_repo }}:${{ needs.publish-webapp.outputs.version }}

# Announce the freshly published mutable `main` webapp image to subscriber
# repos in the org via repository_dispatch, handing them a digest-pinned ref to
# build or deploy from. Fires only for the `main` tag — never semver releases or
# other tag builds — and only from the canonical repo (forks have no PAT).
dispatch-main-image:
name: 📣 Dispatch main image
needs: [publish-webapp]
if: github.repository == 'triggerdotdev/trigger.dev' && needs.publish-webapp.outputs.version == 'main'
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Build dispatch payload
id: payload
env:
IMAGE_REPO: ${{ needs.publish-webapp.outputs.image_repo }}
DIGEST: ${{ needs.publish-webapp.outputs.digest }}
COMMIT: ${{ github.sha }}
run: |
set -euo pipefail
# Pin to the exact multi-arch index just pushed so subscribers resolve a
# single immutable artifact rather than chasing the moving `main` tag.
if [[ -z "${DIGEST}" ]]; then
echo "::error::publish-webapp produced no image digest; refusing to dispatch"
exit 1
fi
image="${IMAGE_REPO}@${DIGEST}"
# jq --arg JSON-escapes every value, so the ref/commit can't break out of
# or inject into the client payload.
payload=$(jq -nc \
--arg img "$image" \
--arg c "$COMMIT" \
'{image: $img, commit: $c}')
echo "client_payload=$payload" >> "$GITHUB_OUTPUT"

- name: Send repository_dispatch
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
with:
token: ${{ secrets.CROSS_REPO_PAT }}
repository: triggerdotdev/cloud
event-type: main-image-published
client-payload: ${{ steps.payload.outputs.client_payload }}
Loading