11name : Promote testing to main
22
3- # Runs after the testing branch advances (publish.yml fast-forwards it on each
4- # successful build). Resolves the current :testing image digests, writes them to
5- # .github/release-state.yaml on the auto/promote-testing-to-main branch, and opens
6- # or updates the always-open PR against main.
7- #
8- # Merging that PR (requires 2 projectbluefin/maintainers) triggers execute-release.yml
9- # which promotes :testing -> :stable.
3+ # Thin caller — logic lives in projectbluefin/actions/reusable-promote.yml
4+ # Replaces the previous 183-line promote-testing-to-main.yml.
105
116on :
127 push :
@@ -25,159 +20,10 @@ permissions:
2520
2621jobs :
2722 promote :
28- name : Open or update testing to main PR
29- runs-on : ubuntu-latest
30- timeout-minutes : 10
31- permissions :
32- contents : write
33- packages : read
34- pull-requests : write
35- outputs :
36- changed : ${{ steps.branch.outputs.changed }}
37- pr_number : ${{ steps.pr.outputs.pr_number }}
38- testing_sha : ${{ steps.digests.outputs.dakota_digest }}
39- steps :
40- - name : Checkout repository
41- uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
42- with :
43- fetch-depth : 0
44- ref : main
45-
46- - name : Configure git
47- run : |
48- git config user.name "github-actions[bot]"
49- git config user.email "github-actions[bot]@users.noreply.github.com"
50-
51- - name : Authenticate to GHCR for skopeo reads
52- env :
53- GH_TOKEN : ${{ github.token }}
54- run : |
55- echo "$GH_TOKEN" | skopeo login ghcr.io --username "${{ github.actor }}" --password-stdin
56-
57- - name : Resolve current testing image digests
58- id : digests
59- env :
60- REGISTRY : ghcr.io/${{ github.repository_owner }}
61- run : |
62- set -euo pipefail
63- dakota_digest=$(skopeo inspect --format '{{.Digest}}' "docker://${REGISTRY}/dakota:testing")
64- nvidia_digest=$(skopeo inspect --format '{{.Digest}}' "docker://${REGISTRY}/dakota-nvidia:testing" 2>/dev/null || echo "")
65- {
66- echo "dakota_digest=${dakota_digest}"
67- echo "nvidia_digest=${nvidia_digest}"
68- } >> "$GITHUB_OUTPUT"
69- echo "dakota:testing -> ${dakota_digest}"
70- echo "dakota-nvidia:testing -> ${nvidia_digest:-not available}"
71-
72- - name : Create or update promotion branch
73- id : branch
74- env :
75- DAKOTA_DIGEST : ${{ steps.digests.outputs.dakota_digest }}
76- NVIDIA_DIGEST : ${{ steps.digests.outputs.nvidia_digest }}
77- PROMOTION_BRANCH : auto/promote-testing-to-main
78- run : |
79- set -euo pipefail
80- git fetch origin "$PROMOTION_BRANCH" 2>/dev/null || true
81-
82- git checkout -B "$PROMOTION_BRANCH" origin/main
83-
84- mkdir -p .github
85- {
86- printf '# Managed by promote-testing-to-main.yml. Do not edit manually.\n'
87- printf '# Merging the PR that updates this file promotes these digests to :stable.\n'
88- printf 'testing:\n'
89- printf ' dakota: "%s"\n' "${DAKOTA_DIGEST}"
90- printf ' dakota-nvidia: "%s"\n' "${NVIDIA_DIGEST}"
91- printf 'updated_at: "%s"\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
92- } > .github/release-state.yaml
93-
94- git add .github/release-state.yaml
95- if git diff --cached --quiet; then
96- echo "changed=false" >> "$GITHUB_OUTPUT"
97- echo "No digest changes since last promotion PR update. No push needed."
98- exit 0
99- fi
100-
101- git commit -m "ci: update testing image digests for stable promotion"
102- git push origin "$PROMOTION_BRANCH" --force-with-lease
103- echo "changed=true" >> "$GITHUB_OUTPUT"
104-
105- - name : Open or update promotion PR
106- id : pr
107- if : steps.branch.outputs.changed == 'true'
108- env :
109- DAKOTA_DIGEST : ${{ steps.digests.outputs.dakota_digest }}
110- GH_TOKEN : ${{ github.token }}
111- NVIDIA_DIGEST : ${{ steps.digests.outputs.nvidia_digest }}
112- run : |
113- set -euo pipefail
114- PROMOTION_BRANCH="auto/promote-testing-to-main"
115- SHORT="${DAKOTA_DIGEST:7:16}"
116- PR_TITLE="ci: promote testing images to stable (${SHORT})"
117-
118- PR_BODY=$(cat <<EOF
119- Promote the current :testing images to :stable.
120-
121- Merge this PR (requires 2 projectbluefin/maintainers) to publish a stable release.
122-
123- Source digests
124- | Image | Digest |
125- |---|---|
126- | dakota:testing | ${DAKOTA_DIGEST} |
127- | dakota-nvidia:testing | ${NVIDIA_DIGEST} |
128-
129- When merged, execute-release.yml will re-verify cosign signatures on
130- the above digests, copy each to :stable, and create a GitHub release.
131- EOF
132- )
133-
134- existing=$(gh pr list \
135- --repo "${{ github.repository }}" \
136- --head "$PROMOTION_BRANCH" \
137- --base main \
138- --state open \
139- --json number \
140- --jq '.[0].number // empty')
141-
142- if [ -n "$existing" ]; then
143- gh pr edit "$existing" \
144- --repo "${{ github.repository }}" \
145- --title "$PR_TITLE" \
146- --body "$PR_BODY"
147- echo "Updated PR #${existing}"
148- PR_NUMBER="$existing"
149- else
150- PR_URL=$(gh pr create \
151- --repo "${{ github.repository }}" \
152- --head "$PROMOTION_BRANCH" \
153- --base main \
154- --title "$PR_TITLE" \
155- --body "$PR_BODY")
156- PR_NUMBER="${PR_URL##*/}"
157- echo "Created new promotion PR #${PR_NUMBER}"
158- fi
159-
160- echo "pr_number=${PR_NUMBER}" >> "$GITHUB_OUTPUT"
161-
162- gate :
163- name : Release gate checks
164- needs : [promote]
165- if : needs.promote.outputs.changed == 'true'
166- permissions :
167- actions : read
168- contents : read
169- issues : write
170- packages : read
171- pull-requests : write
172- uses : projectbluefin/actions/.github/workflows/reusable-release-gate.yml@7f79969c2ff74c51ac7f385cb0a86414975308d7 # v1
23+ uses : projectbluefin/actions/.github/workflows/reusable-promote.yml@8487dff61267ca80486164379fcfc21901d2021e # v1
17324 with :
174- repo : ${{ github.repository }}
175- pr_number : ${{ needs.promote.outputs.pr_number }}
176- head_sha : ${{ needs.promote.outputs.testing_sha }}
177- registry : ghcr.io/projectbluefin
178- variants : >-
179- [{"image":"dakota"},{"image":"dakota-nvidia"}]
180- cosign_identity_regexp : ^https://github\.com/projectbluefin/(dakota|actions)/\.github/workflows/
181- target_tag : testing
25+ variants : ' ["dakota","dakota-nvidia"]'
26+ cosign_identity_regexp : >-
27+ ^https://github\.com/projectbluefin/(dakota|actions)/\.github/workflows/
18228 run_e2e : false
18329 secrets : inherit
0 commit comments