Skip to content

Commit 43cd39a

Browse files
committed
feat(ci): sync-version workflow receives repository_dispatch from main repo
Triggered by atmosphere/atmosphere's release-4x.yml after a successful release. Pulls the version from client_payload, runs scripts/update-doc-versions.sh, commits and pushes under GITHUB_TOKEN. Closes the cross-repo automation gap that shipped 4.0.36 with 23 stale SNAPSHOT references.
1 parent c955c6c commit 43cd39a

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/sync-version.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: "Sync: Atmosphere release version"
2+
3+
# Triggered by a repository_dispatch from the main atmosphere repo's
4+
# release-4x.yml workflow after a successful release. Runs the local
5+
# scripts/update-doc-versions.sh to bump every stale version reference
6+
# in the Starlight tutorial + Async-IO landing site, then commits and
7+
# pushes under the default GITHUB_TOKEN — no cross-repo auth needed.
8+
#
9+
# Release 4.0.36 shipped the sibling repo with 23 stale SNAPSHOT
10+
# references because this workflow did not exist. It closes the gap.
11+
12+
on:
13+
repository_dispatch:
14+
types: [sync-version]
15+
workflow_dispatch:
16+
inputs:
17+
version:
18+
description: 'Atmosphere release version (e.g. 4.0.37)'
19+
required: true
20+
type: string
21+
22+
jobs:
23+
sync:
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: write
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
ref: main
31+
fetch-depth: 0
32+
token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Resolve version from payload
35+
id: version
36+
run: |
37+
VERSION="${{ github.event.client_payload.version || inputs.version }}"
38+
if [ -z "$VERSION" ]; then
39+
echo "::error ::No version supplied in client_payload or workflow_dispatch input" >&2
40+
exit 1
41+
fi
42+
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9.]+)?$'; then
43+
echo "::error ::Invalid version format: $VERSION" >&2
44+
exit 1
45+
fi
46+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
47+
echo "Syncing atmosphere.github.io to $VERSION"
48+
49+
- name: Run update-doc-versions.sh
50+
run: ./scripts/update-doc-versions.sh "${{ steps.version.outputs.version }}"
51+
52+
- name: Commit and push version sync
53+
run: |
54+
git config user.name "atmosphere-release-bot"
55+
git config user.email "actions@github.com"
56+
if git diff --quiet; then
57+
echo "::notice ::Already at ${{ steps.version.outputs.version }} — no version changes to sync"
58+
exit 0
59+
fi
60+
git add -A
61+
git commit -m "chore(docs): sync to Atmosphere ${{ steps.version.outputs.version }}"
62+
git push origin main
63+
echo "::notice ::atmosphere.github.io synced to ${{ steps.version.outputs.version }}"

0 commit comments

Comments
 (0)