Skip to content

Commit 32b54a4

Browse files
committed
feat(ci): dispatch a repository event when the main webapp image is published
After the webapp image is pushed on a main build, emit a repository_dispatch (main-image-published) carrying a digest-pinned image ref so other repositories in the org can build or deploy from the exact artifact rather than chasing the moving main tag. Fires only for the mutable main tag, never semver releases or other tag builds, and only from the canonical repo.
1 parent 6bcd369 commit 32b54a4

4 files changed

Lines changed: 60 additions & 8 deletions

File tree

.claude/rules/server-apps.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ area: webapp
1414
type: fix
1515
---
1616
17-
Brief description of what changed and why.
17+
A sentence or two on why this is better for users — what they can now do, what's
18+
faster, or what no longer breaks. Describe the change from the user's perspective,
19+
not the code change.
1820
EOF
1921
```
2022

.github/workflows/publish-webapp.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ on:
2929
image_repo:
3030
description: The image repository the build was published to (without tag)
3131
value: ${{ jobs.publish.outputs.image_repo }}
32+
digest:
33+
description: Multi-arch index digest (sha256:...) of the published image
34+
value: ${{ jobs.publish.outputs.digest }}
3235
secrets:
3336
SENTRY_AUTH_TOKEN:
3437
required: false
@@ -42,6 +45,7 @@ jobs:
4245
version: ${{ steps.get_tag.outputs.tag }}
4346
short_sha: ${{ steps.get_commit.outputs.sha_short }}
4447
image_repo: ${{ steps.set_tags.outputs.image_repo }}
48+
digest: ${{ steps.build_push.outputs.digest }}
4549
steps:
4650
- name: 🏭 Setup Depot CLI
4751
uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1

.github/workflows/publish.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ on:
1515
required: false
1616
SENTRY_AUTH_TOKEN:
1717
required: false
18+
CROSS_REPO_PAT:
19+
required: false
1820
push:
1921
branches:
2022
- main
@@ -112,3 +114,45 @@ jobs:
112114
uses: ./.github/workflows/trivy-image-webapp.yml
113115
with:
114116
image-ref: ${{ needs.publish-webapp.outputs.image_repo }}:${{ needs.publish-webapp.outputs.version }}
117+
118+
# Announce the freshly published mutable `main` webapp image to subscriber
119+
# repos in the org via repository_dispatch, handing them a digest-pinned ref to
120+
# build or deploy from. Fires only for the `main` tag — never semver releases or
121+
# other tag builds — and only from the canonical repo (forks have no PAT).
122+
dispatch-main-image:
123+
name: 📣 Dispatch main image
124+
needs: [publish-webapp]
125+
if: github.repository == 'triggerdotdev/trigger.dev' && needs.publish-webapp.outputs.version == 'main'
126+
runs-on: ubuntu-latest
127+
permissions: {}
128+
steps:
129+
- name: Build dispatch payload
130+
id: payload
131+
env:
132+
IMAGE_REPO: ${{ needs.publish-webapp.outputs.image_repo }}
133+
DIGEST: ${{ needs.publish-webapp.outputs.digest }}
134+
COMMIT: ${{ github.sha }}
135+
run: |
136+
set -euo pipefail
137+
# Pin to the exact multi-arch index just pushed so subscribers resolve a
138+
# single immutable artifact rather than chasing the moving `main` tag.
139+
if [[ -z "${DIGEST}" ]]; then
140+
echo "::error::publish-webapp produced no image digest; refusing to dispatch"
141+
exit 1
142+
fi
143+
image="${IMAGE_REPO}@${DIGEST}"
144+
# jq --arg JSON-escapes every value, so the ref/commit can't break out of
145+
# or inject into the client payload.
146+
payload=$(jq -nc \
147+
--arg img "$image" \
148+
--arg c "$COMMIT" \
149+
'{image: $img, commit: $c}')
150+
echo "client_payload=$payload" >> "$GITHUB_OUTPUT"
151+
152+
- name: Send repository_dispatch
153+
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
154+
with:
155+
token: ${{ secrets.CROSS_REPO_PAT }}
156+
repository: triggerdotdev/cloud
157+
event-type: main-image-published
158+
client-payload: ${{ steps.payload.outputs.client_payload }}

.server-changes/README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ Speed up batch queue processing by removing stalls and fixing retry race
3636

3737
### Description
3838

39-
The body text (below the frontmatter) is a one-line description of the change. Keep it concise — it will appear in release notes.
39+
The body text (below the frontmatter) is a short, user-facing description of the change. It appears verbatim in release notes.
4040

4141
### Writing guidance
4242

43-
These entries are public-facing - they ship verbatim in user-visible release notes. A few rules to keep them clean:
43+
These entries are public-facing they ship verbatim in user-visible release notes. Write them for users, not for whoever reviews the diff:
4444

45-
- **One sentence is usually enough.** The body is the bullet in the changelog. If you need a paragraph, you're probably describing the implementation rather than the change.
45+
- **Lead with the user benefit.** A sentence or two on why the product is better now — what users can do, what's faster, what no longer breaks. The "why" matters more than a precise account of "what changed."
4646
- **Describe behavior, not implementation.** Skip internal scopes, middleware names, library specifics, framework internals. Users care about what's different for them, not how it's wired.
47-
- **Never name internal tools or infra.** Observability stacks, internal services, infra components, monitoring backends, CI surfaces, AWS specifics - none of these belong in user-facing notes.
47+
- **Never name internal tools or infra.** Observability stacks, internal services, infra components, monitoring backends, CI surfaces, AWS specifics none of these belong in user-facing notes.
4848

4949
## Lifecycle
5050

@@ -63,7 +63,8 @@ area: webapp
6363
type: feature
6464
---
6565

66-
TRQL query language and the Query page
66+
Query your runs with TRQL from the new Query page, so you can slice and explore run
67+
data without leaving the dashboard.
6768
```
6869

6970
**Bug fix:**
@@ -74,7 +75,8 @@ area: webapp
7475
type: fix
7576
---
7677

77-
Fix schedule limit counting for orgs with custom limits
78+
Schedule limits now count correctly for orgs with custom limits, so you can create
79+
every schedule your plan allows.
7880
```
7981

8082
**Improvement:**
@@ -85,5 +87,5 @@ area: webapp
8587
type: improvement
8688
---
8789

88-
Use the replica for API auth queries to reduce primary load
90+
The dashboard and API stay responsive under heavy load.
8991
```

0 commit comments

Comments
 (0)