Skip to content

Commit fcd515c

Browse files
committed
ci: add cd steps to publish workflow
1 parent cdaa40b commit fcd515c

1 file changed

Lines changed: 64 additions & 1 deletion

File tree

.github/workflows/docker-publish.yml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Docker Publish
22

33
on:
44
push:
5-
branches: [master, main]
5+
branches: [master]
66
tags:
77
- 'v*'
88
workflow_dispatch:
@@ -108,3 +108,66 @@ jobs:
108108
- name: Inspect
109109
run: |
110110
docker buildx imagetools inspect ${IMAGE}:${{ steps.meta.outputs.version }}
111+
112+
update-manifest:
113+
name: Bump graph-node image tag in beam-k8s-infra-apps
114+
runs-on: ubuntu-latest
115+
needs: merge
116+
if: github.ref == 'refs/heads/master'
117+
concurrency:
118+
group: update-k8s-manifest-graph-node
119+
cancel-in-progress: false
120+
steps:
121+
- name: Checkout beam-k8s-infra-apps
122+
uses: actions/checkout@v5
123+
with:
124+
repository: BuildOnBeam/beam-k8s-infra-apps
125+
ref: main
126+
token: ${{ secrets.K8S_REPO_PAT }}
127+
path: infra
128+
129+
- name: Install kustomize
130+
run: |
131+
KUSTOMIZE_VERSION=5.4.3
132+
curl -fsSL \
133+
"https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz" \
134+
| sudo tar -xz -C /usr/local/bin
135+
kustomize version
136+
137+
- name: Update image tag
138+
id: bump
139+
working-directory: infra
140+
run: |
141+
SHORT_SHA=${GITHUB_SHA::7}
142+
TAG="sha-${SHORT_SHA}"
143+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
144+
(cd apps/graph-node/base && kustomize edit set image "${IMAGE}=${IMAGE}:${TAG}")
145+
if git diff --quiet apps/graph-node/base/kustomization.yaml; then
146+
echo "kustomization already at $TAG — nothing to commit."
147+
echo "changed=false" >> "$GITHUB_OUTPUT"
148+
else
149+
echo "changed=true" >> "$GITHUB_OUTPUT"
150+
git diff apps/graph-node/base/kustomization.yaml
151+
fi
152+
153+
- name: Commit and push
154+
if: steps.bump.outputs.changed == 'true'
155+
working-directory: infra
156+
run: |
157+
git config user.name "github-actions[bot]"
158+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
159+
git add apps/graph-node/base/kustomization.yaml
160+
git commit -m "ci(graph-node): update image to ${{ steps.bump.outputs.tag }}"
161+
for attempt in 1 2 3; do
162+
if git push origin main; then
163+
echo "Pushed on attempt $attempt."
164+
exit 0
165+
fi
166+
echo "Push rejected; rebasing on main and retrying..."
167+
git pull --rebase origin main || {
168+
echo "::error::Rebase hit a conflict on apps/graph-node/base/kustomization.yaml — manual resolution needed. Image ${IMAGE}:${{ steps.bump.outputs.tag }} is already on Docker Hub."
169+
exit 1
170+
}
171+
done
172+
echo "::error::Failed to push after 3 attempts. Image ${IMAGE}:${{ steps.bump.outputs.tag }} is on Docker Hub; bump the manifest manually."
173+
exit 1

0 commit comments

Comments
 (0)