Skip to content

Commit 57bee51

Browse files
committed
Rename token secret to CONDA_FORGE_RELEASE
1 parent 3fae0ee commit 57bee51

File tree

2 files changed

+127
-219
lines changed

2 files changed

+127
-219
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: _Conda Forge Package Release
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
package:
7+
description: 'Package name (e.g. sagemaker-train)'
8+
required: true
9+
type: string
10+
feedstock:
11+
description: 'Feedstock repo (e.g. conda-forge/sagemaker-train-feedstock)'
12+
required: true
13+
type: string
14+
pr_search:
15+
description: 'PR title search string (e.g. sagemaker-train v1.6.0)'
16+
required: true
17+
type: string
18+
poll_interval:
19+
required: true
20+
type: string
21+
max_attempts:
22+
required: true
23+
type: string
24+
secrets:
25+
token:
26+
required: true
27+
28+
jobs:
29+
release:
30+
runs-on: ubuntu-latest
31+
env:
32+
GH_TOKEN: ${{ secrets.token }}
33+
steps:
34+
- name: Rerun failed checks or skip if already merged
35+
run: |
36+
REPO="${{ inputs.feedstock }}"
37+
SEARCH="${{ inputs.pr_search }}"
38+
STATE=$(gh pr list --repo "$REPO" --state all \
39+
--search "$SEARCH" --json state -q '.[0].state // "NOT_FOUND"')
40+
echo "Current state: ${STATE}"
41+
if [ "$STATE" = "MERGED" ]; then
42+
echo "Already merged, skipping."; exit 0
43+
fi
44+
PR=$(gh pr list --repo "$REPO" --state open \
45+
--search "$SEARCH" --json number -q '.[0].number')
46+
[ -z "$PR" ] && echo "No open PR found." && exit 1
47+
echo "PR #${PR}"
48+
BRANCH=$(gh pr view "$PR" --repo "$REPO" --json headRefName -q .headRefName)
49+
RUN_ID=$(gh run list --repo "$REPO" --branch "$BRANCH" \
50+
--json databaseId,conclusion -q \
51+
'[.[] | select(.conclusion=="failure")][0].databaseId')
52+
[ -n "$RUN_ID" ] && gh run rerun "$RUN_ID" --repo "$REPO" --failed \
53+
|| echo "No failed runs."
54+
55+
- name: Wait for merge
56+
run: |
57+
REPO="${{ inputs.feedstock }}"
58+
SEARCH="${{ inputs.pr_search }}"
59+
for i in $(seq 1 ${{ inputs.max_attempts }}); do
60+
STATE=$(gh pr list --repo "$REPO" --state all \
61+
--search "$SEARCH" --json state -q '.[0].state // "NOT_FOUND"')
62+
echo "Attempt $i: ${STATE}"
63+
[ "$STATE" = "MERGED" ] && exit 0
64+
sleep ${{ inputs.poll_interval }}
65+
done
66+
echo "Timed out waiting for ${{ inputs.package }}." && exit 1

.github/workflows/conda-forge-release-chain.yml

Lines changed: 61 additions & 219 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@ on:
1212
required: false
1313
default: '60'
1414

15-
env:
16-
GH_TOKEN: ${{ secrets.GH_PAT }}
17-
POLL_INTERVAL: ${{ github.event.inputs.poll_interval_seconds }}
18-
MAX_ATTEMPTS: ${{ github.event.inputs.timeout_attempts }}
19-
2015
jobs:
21-
# ── Read versions from VERSION files ────────────────────────────────────────
2216
read-versions:
2317
runs-on: ubuntu-latest
2418
outputs:
@@ -33,243 +27,91 @@ jobs:
3327
- name: Read versions
3428
id: v
3529
run: |
36-
echo "core=$(cat sagemaker-core/VERSION)" >> $GITHUB_OUTPUT
37-
echo "train=$(cat sagemaker-train/VERSION)" >> $GITHUB_OUTPUT
38-
echo "serve=$(cat sagemaker-serve/VERSION)" >> $GITHUB_OUTPUT
39-
echo "mlops=$(cat sagemaker-mlops/VERSION)" >> $GITHUB_OUTPUT
40-
echo "pysdk=$(cat VERSION)" >> $GITHUB_OUTPUT
41-
echo "meta=$(cat VERSION)" >> $GITHUB_OUTPUT
42-
- name: Print versions
43-
run: |
44-
echo "sagemaker-core: $(cat sagemaker-core/VERSION)"
45-
echo "sagemaker-train: $(cat sagemaker-train/VERSION)"
46-
echo "sagemaker-serve: $(cat sagemaker-serve/VERSION)"
47-
echo "sagemaker-mlops: $(cat sagemaker-mlops/VERSION)"
48-
echo "sagemaker-python-sdk: $(cat VERSION)"
49-
echo "sagemaker (meta): $(cat VERSION)"
30+
echo "core=$(cat sagemaker-core/VERSION)" >> $GITHUB_OUTPUT
31+
echo "train=$(cat sagemaker-train/VERSION)" >> $GITHUB_OUTPUT
32+
echo "serve=$(cat sagemaker-serve/VERSION)" >> $GITHUB_OUTPUT
33+
echo "mlops=$(cat sagemaker-mlops/VERSION)" >> $GITHUB_OUTPUT
34+
echo "pysdk=$(cat VERSION)" >> $GITHUB_OUTPUT
35+
echo "meta=$(cat VERSION)" >> $GITHUB_OUTPUT
36+
cat sagemaker-core/VERSION sagemaker-train/VERSION sagemaker-serve/VERSION \
37+
sagemaker-mlops/VERSION VERSION | paste - - - - - \
38+
| awk '{print "core="$1" train="$2" serve="$3" mlops="$4" pysdk/meta="$5}'
5039
51-
# ── 1. Wait for sagemaker-core (automerges on its own) ──────────────────────
5240
wait-sagemaker-core:
5341
needs: read-versions
5442
runs-on: ubuntu-latest
43+
env:
44+
GH_TOKEN: ${{ secrets.GH_PAT }}
5545
steps:
56-
- name: Wait for sagemaker-core feedstock PR to merge
46+
- name: Wait for sagemaker-core to merge (automerges on its own)
5747
run: |
58-
VERSION="${{ needs.read-versions.outputs.core }}"
5948
REPO="conda-forge/sagemaker-core-feedstock"
60-
echo "Waiting for: [bot-automerge] sagemaker-core v${VERSION}"
61-
for i in $(seq 1 $MAX_ATTEMPTS); do
49+
SEARCH="[bot-automerge] sagemaker-core v${{ needs.read-versions.outputs.core }}"
50+
for i in $(seq 1 ${{ github.event.inputs.timeout_attempts }}); do
6251
STATE=$(gh pr list --repo "$REPO" --state all \
63-
--search "[bot-automerge] sagemaker-core v${VERSION}" \
64-
--json state -q '.[0].state // "NOT_FOUND"')
52+
--search "$SEARCH" --json state -q '.[0].state // "NOT_FOUND"')
6553
echo "Attempt $i: ${STATE}"
6654
[ "$STATE" = "MERGED" ] && exit 0
67-
sleep $POLL_INTERVAL
55+
sleep ${{ github.event.inputs.poll_interval_seconds }}
6856
done
6957
echo "Timed out." && exit 1
7058
71-
# ── 2. sagemaker-train ───────────────────────────────────────────────────────
7259
release-sagemaker-train:
7360
needs: [read-versions, wait-sagemaker-core]
74-
runs-on: ubuntu-latest
75-
steps:
76-
- name: Rerun failed checks
77-
run: |
78-
VERSION="${{ needs.read-versions.outputs.train }}"
79-
REPO="conda-forge/sagemaker-train-feedstock"
80-
STATE=$(gh pr list --repo "$REPO" --state all \
81-
--search "sagemaker-train v${VERSION}" \
82-
--json state -q '.[0].state // "NOT_FOUND"')
83-
if [ "$STATE" = "MERGED" ]; then
84-
echo "Already merged, skipping rerun."; exit 0
85-
fi
86-
PR=$(gh pr list --repo "$REPO" --state open \
87-
--search "sagemaker-train v${VERSION}" \
88-
--json number -q '.[0].number')
89-
[ -z "$PR" ] && echo "No open PR found." && exit 1
90-
echo "PR #${PR}"
91-
BRANCH=$(gh pr view "$PR" --repo "$REPO" --json headRefName -q .headRefName)
92-
RUN_ID=$(gh run list --repo "$REPO" --branch "$BRANCH" \
93-
--json databaseId,conclusion -q \
94-
'[.[] | select(.conclusion=="failure")][0].databaseId')
95-
[ -n "$RUN_ID" ] && gh run rerun "$RUN_ID" --repo "$REPO" --failed \
96-
|| echo "No failed runs."
97-
- name: Wait for merge
98-
run: |
99-
VERSION="${{ needs.read-versions.outputs.train }}"
100-
REPO="conda-forge/sagemaker-train-feedstock"
101-
for i in $(seq 1 $MAX_ATTEMPTS); do
102-
STATE=$(gh pr list --repo "$REPO" --state all \
103-
--search "sagemaker-train v${VERSION}" \
104-
--json state -q '.[0].state // "NOT_FOUND"')
105-
echo "Attempt $i: ${STATE}"
106-
[ "$STATE" = "MERGED" ] && exit 0
107-
sleep $POLL_INTERVAL
108-
done
109-
echo "Timed out." && exit 1
61+
uses: ./.github/workflows/_conda-forge-package-release.yml
62+
with:
63+
package: sagemaker-train
64+
feedstock: conda-forge/sagemaker-train-feedstock
65+
pr_search: "sagemaker-train v${{ needs.read-versions.outputs.train }}"
66+
poll_interval: ${{ github.event.inputs.poll_interval_seconds }}
67+
max_attempts: ${{ github.event.inputs.timeout_attempts }}
68+
secrets:
69+
token: ${{ secrets.GH_PAT }}
11070

111-
# ── 3. sagemaker-serve ───────────────────────────────────────────────────────
11271
release-sagemaker-serve:
11372
needs: [read-versions, release-sagemaker-train]
114-
runs-on: ubuntu-latest
115-
steps:
116-
- name: Rerun failed checks
117-
run: |
118-
VERSION="${{ needs.read-versions.outputs.serve }}"
119-
REPO="conda-forge/sagemaker-serve-feedstock"
120-
STATE=$(gh pr list --repo "$REPO" --state all \
121-
--search "sagemaker-serve v${VERSION}" \
122-
--json state -q '.[0].state // "NOT_FOUND"')
123-
if [ "$STATE" = "MERGED" ]; then
124-
echo "Already merged, skipping rerun."; exit 0
125-
fi
126-
PR=$(gh pr list --repo "$REPO" --state open \
127-
--search "sagemaker-serve v${VERSION}" \
128-
--json number -q '.[0].number')
129-
[ -z "$PR" ] && echo "No open PR found." && exit 1
130-
BRANCH=$(gh pr view "$PR" --repo "$REPO" --json headRefName -q .headRefName)
131-
RUN_ID=$(gh run list --repo "$REPO" --branch "$BRANCH" \
132-
--json databaseId,conclusion -q \
133-
'[.[] | select(.conclusion=="failure")][0].databaseId')
134-
[ -n "$RUN_ID" ] && gh run rerun "$RUN_ID" --repo "$REPO" --failed \
135-
|| echo "No failed runs."
136-
- name: Wait for merge
137-
run: |
138-
VERSION="${{ needs.read-versions.outputs.serve }}"
139-
REPO="conda-forge/sagemaker-serve-feedstock"
140-
for i in $(seq 1 $MAX_ATTEMPTS); do
141-
STATE=$(gh pr list --repo "$REPO" --state all \
142-
--search "sagemaker-serve v${VERSION}" \
143-
--json state -q '.[0].state // "NOT_FOUND"')
144-
echo "Attempt $i: ${STATE}"
145-
[ "$STATE" = "MERGED" ] && exit 0
146-
sleep $POLL_INTERVAL
147-
done
148-
echo "Timed out." && exit 1
73+
uses: ./.github/workflows/_conda-forge-package-release.yml
74+
with:
75+
package: sagemaker-serve
76+
feedstock: conda-forge/sagemaker-serve-feedstock
77+
pr_search: "sagemaker-serve v${{ needs.read-versions.outputs.serve }}"
78+
poll_interval: ${{ github.event.inputs.poll_interval_seconds }}
79+
max_attempts: ${{ github.event.inputs.timeout_attempts }}
80+
secrets:
81+
token: ${{ secrets.GH_PAT }}
14982

150-
# ── 4. sagemaker-mlops ───────────────────────────────────────────────────────
15183
release-sagemaker-mlops:
15284
needs: [read-versions, release-sagemaker-serve]
153-
runs-on: ubuntu-latest
154-
steps:
155-
- name: Rerun failed checks
156-
run: |
157-
VERSION="${{ needs.read-versions.outputs.mlops }}"
158-
REPO="conda-forge/sagemaker-mlops-feedstock"
159-
STATE=$(gh pr list --repo "$REPO" --state all \
160-
--search "sagemaker-mlops v${VERSION}" \
161-
--json state -q '.[0].state // "NOT_FOUND"')
162-
if [ "$STATE" = "MERGED" ]; then
163-
echo "Already merged, skipping rerun."; exit 0
164-
fi
165-
PR=$(gh pr list --repo "$REPO" --state open \
166-
--search "sagemaker-mlops v${VERSION}" \
167-
--json number -q '.[0].number')
168-
[ -z "$PR" ] && echo "No open PR found." && exit 1
169-
BRANCH=$(gh pr view "$PR" --repo "$REPO" --json headRefName -q .headRefName)
170-
RUN_ID=$(gh run list --repo "$REPO" --branch "$BRANCH" \
171-
--json databaseId,conclusion -q \
172-
'[.[] | select(.conclusion=="failure")][0].databaseId')
173-
[ -n "$RUN_ID" ] && gh run rerun "$RUN_ID" --repo "$REPO" --failed \
174-
|| echo "No failed runs."
175-
- name: Wait for merge
176-
run: |
177-
VERSION="${{ needs.read-versions.outputs.mlops }}"
178-
REPO="conda-forge/sagemaker-mlops-feedstock"
179-
for i in $(seq 1 $MAX_ATTEMPTS); do
180-
STATE=$(gh pr list --repo "$REPO" --state all \
181-
--search "sagemaker-mlops v${VERSION}" \
182-
--json state -q '.[0].state // "NOT_FOUND"')
183-
echo "Attempt $i: ${STATE}"
184-
[ "$STATE" = "MERGED" ] && exit 0
185-
sleep $POLL_INTERVAL
186-
done
187-
echo "Timed out." && exit 1
85+
uses: ./.github/workflows/_conda-forge-package-release.yml
86+
with:
87+
package: sagemaker-mlops
88+
feedstock: conda-forge/sagemaker-mlops-feedstock
89+
pr_search: "sagemaker-mlops v${{ needs.read-versions.outputs.mlops }}"
90+
poll_interval: ${{ github.event.inputs.poll_interval_seconds }}
91+
max_attempts: ${{ github.event.inputs.timeout_attempts }}
92+
secrets:
93+
token: ${{ secrets.GH_PAT }}
18894

189-
# ── 5. sagemaker-python-sdk-feedstock ───────────────────────────────────────
19095
release-sagemaker-python-sdk:
19196
needs: [read-versions, release-sagemaker-mlops]
192-
runs-on: ubuntu-latest
193-
steps:
194-
- name: Rerun failed checks
195-
run: |
196-
VERSION="${{ needs.read-versions.outputs.pysdk }}"
197-
REPO="conda-forge/sagemaker-python-sdk-feedstock"
198-
STATE=$(gh pr list --repo "$REPO" --state all \
199-
--search "[bot-automerge] sagemaker-python-sdk v${VERSION}" \
200-
--json state -q '.[0].state // "NOT_FOUND"')
201-
if [ "$STATE" = "MERGED" ]; then
202-
echo "Already merged, skipping rerun."; exit 0
203-
fi
204-
PR=$(gh pr list --repo "$REPO" --state open \
205-
--search "[bot-automerge] sagemaker-python-sdk v${VERSION}" \
206-
--json number -q '.[0].number')
207-
[ -z "$PR" ] && echo "No open PR found." && exit 1
208-
BRANCH=$(gh pr view "$PR" --repo "$REPO" --json headRefName -q .headRefName)
209-
RUN_ID=$(gh run list --repo "$REPO" --branch "$BRANCH" \
210-
--json databaseId,conclusion -q \
211-
'[.[] | select(.conclusion=="failure")][0].databaseId')
212-
[ -n "$RUN_ID" ] && gh run rerun "$RUN_ID" --repo "$REPO" --failed \
213-
|| echo "No failed runs."
214-
- name: Wait for merge
215-
run: |
216-
VERSION="${{ needs.read-versions.outputs.pysdk }}"
217-
REPO="conda-forge/sagemaker-python-sdk-feedstock"
218-
for i in $(seq 1 $MAX_ATTEMPTS); do
219-
STATE=$(gh pr list --repo "$REPO" --state all \
220-
--search "[bot-automerge] sagemaker-python-sdk v${VERSION}" \
221-
--json state -q '.[0].state // "NOT_FOUND"')
222-
echo "Attempt $i: ${STATE}"
223-
[ "$STATE" = "MERGED" ] && exit 0
224-
sleep $POLL_INTERVAL
225-
done
226-
echo "Timed out." && exit 1
97+
uses: ./.github/workflows/_conda-forge-package-release.yml
98+
with:
99+
package: sagemaker-python-sdk
100+
feedstock: conda-forge/sagemaker-python-sdk-feedstock
101+
pr_search: "[bot-automerge] sagemaker-python-sdk v${{ needs.read-versions.outputs.pysdk }}"
102+
poll_interval: ${{ github.event.inputs.poll_interval_seconds }}
103+
max_attempts: ${{ github.event.inputs.timeout_attempts }}
104+
secrets:
105+
token: ${{ secrets.GH_PAT }}
227106

228-
# ── 6. sagemaker (meta-package) ──────────────────────────────────────────────
229107
release-sagemaker:
230108
needs: [read-versions, release-sagemaker-python-sdk]
231-
runs-on: ubuntu-latest
232-
steps:
233-
- name: Rerun failed checks
234-
run: |
235-
VERSION="${{ needs.read-versions.outputs.meta }}"
236-
REPO="conda-forge/sagemaker-feedstock"
237-
STATE=$(gh pr list --repo "$REPO" --state all \
238-
--search "[bot-automerge] sagemaker v${VERSION}" \
239-
--json state -q '.[0].state // "NOT_FOUND"')
240-
if [ "$STATE" = "MERGED" ]; then
241-
echo "Already merged, skipping rerun."; exit 0
242-
fi
243-
PR=$(gh pr list --repo "$REPO" --state open \
244-
--search "[bot-automerge] sagemaker v${VERSION}" \
245-
--json number -q '.[0].number')
246-
[ -z "$PR" ] && echo "No open PR found." && exit 1
247-
BRANCH=$(gh pr view "$PR" --repo "$REPO" --json headRefName -q .headRefName)
248-
RUN_ID=$(gh run list --repo "$REPO" --branch "$BRANCH" \
249-
--json databaseId,conclusion -q \
250-
'[.[] | select(.conclusion=="failure")][0].databaseId')
251-
[ -n "$RUN_ID" ] && gh run rerun "$RUN_ID" --repo "$REPO" --failed \
252-
|| echo "No failed runs."
253-
- name: Wait for merge
254-
run: |
255-
VERSION="${{ needs.read-versions.outputs.meta }}"
256-
REPO="conda-forge/sagemaker-feedstock"
257-
for i in $(seq 1 $MAX_ATTEMPTS); do
258-
STATE=$(gh pr list --repo "$REPO" --state all \
259-
--search "[bot-automerge] sagemaker v${VERSION}" \
260-
--json state -q '.[0].state // "NOT_FOUND"')
261-
echo "Attempt $i: ${STATE}"
262-
[ "$STATE" = "MERGED" ] && exit 0
263-
sleep $POLL_INTERVAL
264-
done
265-
echo "Timed out." && exit 1
266-
267-
- name: Release chain complete
268-
run: |
269-
echo "All packages released on conda-forge:"
270-
echo " sagemaker-core ${{ needs.read-versions.outputs.core }}"
271-
echo " sagemaker-train ${{ needs.read-versions.outputs.train }}"
272-
echo " sagemaker-serve ${{ needs.read-versions.outputs.serve }}"
273-
echo " sagemaker-mlops ${{ needs.read-versions.outputs.mlops }}"
274-
echo " sagemaker-python-sdk ${{ needs.read-versions.outputs.pysdk }}"
275-
echo " sagemaker ${{ needs.read-versions.outputs.meta }}"
109+
uses: ./.github/workflows/_conda-forge-package-release.yml
110+
with:
111+
package: sagemaker
112+
feedstock: conda-forge/sagemaker-feedstock
113+
pr_search: "[bot-automerge] sagemaker v${{ needs.read-versions.outputs.meta }}"
114+
poll_interval: ${{ github.event.inputs.poll_interval_seconds }}
115+
max_attempts: ${{ github.event.inputs.timeout_attempts }}
116+
secrets:
117+
token: ${{ secrets.GH_PAT }}

0 commit comments

Comments
 (0)