@@ -10,22 +10,22 @@ permissions:
1010
1111jobs :
1212 publish-container-image :
13-
1413 runs-on : ubuntu-latest
1514
1615 strategy :
1716 fail-fast : false
1817 matrix :
19- apps : [
20- ai-service,
21- makeline-service,
22- order-service,
23- product-service,
24- store-admin,
25- store-front,
26- virtual-customer,
27- virtual-worker
28- ]
18+ apps :
19+ [
20+ ai-service,
21+ makeline-service,
22+ order-service,
23+ product-service,
24+ store-admin,
25+ store-front,
26+ virtual-customer,
27+ virtual-worker,
28+ ]
2929
3030 steps :
3131 - name : Set environment variables
@@ -45,20 +45,20 @@ jobs:
4545 echo ${{ steps.set-variables.outputs.CREATED }}
4646
4747 - name : Checkout code
48- uses : actions/checkout@v2
48+ uses : actions/checkout@v4
4949
5050 - name : Set up Docker Buildx
51- uses : docker/setup-buildx-action@v2
51+ uses : docker/setup-buildx-action@v3
5252
5353 - name : Login to GitHub Container Registry
54- uses : docker/login-action@v1
54+ uses : docker/login-action@v3
5555 with :
5656 registry : ghcr.io
5757 username : ${{ github.actor }}
5858 password : ${{ github.token }}
5959
6060 - name : Build and push
61- uses : docker/build-push-action@v2
61+ uses : docker/build-push-action@v6
6262 with :
6363 context : src/${{ matrix.apps }}
6464 file : src/${{ matrix.apps }}/Dockerfile
@@ -72,4 +72,147 @@ jobs:
7272 labels : |
7373 org.opencontainers.image.source=${{ github.repositoryUrl }}
7474 org.opencontainers.image.created=${{ steps.set-variables.outputs.CREATED }}
75- org.opencontainers.image.revision=${{ steps.set-variables.outputs.VERSION }}
75+ org.opencontainers.image.revision=${{ steps.set-variables.outputs.VERSION }}
76+
77+ update-manifests :
78+ runs-on : ubuntu-latest
79+ needs : publish-container-image
80+ permissions :
81+ contents : write
82+
83+ steps :
84+ - name : Checkout code
85+ uses : actions/checkout@v4
86+
87+ - name : Set version
88+ id : set-version
89+ run : |
90+ echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> "$GITHUB_OUTPUT"
91+
92+ - name : Update all manifests with new version
93+ run : |
94+ VERSION=${{ steps.set-version.outputs.VERSION }}
95+
96+ # =============================================================================
97+ # Configuration
98+ # =============================================================================
99+
100+ # Apps that have container images in ghcr.io/azure-samples/aks-store-demo
101+ APPS=(
102+ "ai-service"
103+ "makeline-service"
104+ "order-service"
105+ "product-service"
106+ "store-admin"
107+ "store-front"
108+ "virtual-customer"
109+ "virtual-worker"
110+ )
111+
112+ # =============================================================================
113+ # Helper function to update image tags
114+ # =============================================================================
115+
116+ update_full_image_ref() {
117+ # Updates: ghcr.io/azure-samples/aks-store-demo/<app>:<old> -> ghcr.io/azure-samples/aks-store-demo/<app>:<new>
118+ local file=$1
119+ local app=$2
120+ local version=$3
121+ if [ -f "$file" ]; then
122+ sed -i "s|ghcr.io/azure-samples/aks-store-demo/${app}:[^\"]*|ghcr.io/azure-samples/aks-store-demo/${app}:${version}|g" "$file"
123+ echo "Updated full image ref for ${app} in ${file}"
124+ fi
125+ }
126+
127+ update_short_image_ref() {
128+ # Updates: image: <app>:<old> -> image: <app>:<new> (no registry prefix)
129+ local file=$1
130+ local app=$2
131+ local version=$3
132+ if [ -f "$file" ]; then
133+ sed -i "s|image: ${app}:[^\"]*|image: ${app}:${version}|g" "$file"
134+ echo "Updated short image ref for ${app} in ${file}"
135+ fi
136+ }
137+
138+ # =============================================================================
139+ # Update Kubernetes manifests (inline image:tag format)
140+ # =============================================================================
141+
142+ echo "Updating root Kubernetes manifests..."
143+ ROOT_MANIFESTS=(
144+ "ai-service.yaml"
145+ "aks-store-all-in-one.yaml"
146+ "aks-store-quickstart.yaml"
147+ "aks-store-ingress-quickstart.yaml"
148+ )
149+
150+ for APP in "${APPS[@]}"; do
151+ for FILE in "${ROOT_MANIFESTS[@]}"; do
152+ update_full_image_ref "$FILE" "$APP" "$VERSION"
153+ done
154+ done
155+
156+ # =============================================================================
157+ # Update sample manifests
158+ # =============================================================================
159+
160+ echo "Updating sample manifests..."
161+ SAMPLE_MANIFESTS=(
162+ "sample-manifests/docs/app-routing/aks-store-deployments-and-services.yaml"
163+ )
164+
165+ for APP in "${APPS[@]}"; do
166+ for FILE in "${SAMPLE_MANIFESTS[@]}"; do
167+ update_full_image_ref "$FILE" "$APP" "$VERSION"
168+ done
169+ done
170+
171+ # =============================================================================
172+ # Update Kustomize base manifests
173+ # =============================================================================
174+
175+ echo "Updating Kustomize base manifests..."
176+ for APP in "${APPS[@]}"; do
177+ update_full_image_ref "kustomize/base/${APP}.yaml" "$APP" "$VERSION"
178+ done
179+
180+ # =============================================================================
181+ # Update Kustomize overlay manifests
182+ # =============================================================================
183+
184+ echo "Updating Kustomize azd overlay manifests..."
185+ # azd overlay uses short image names (no registry prefix) for ACR
186+ for APP in "${APPS[@]}"; do
187+ update_short_image_ref "kustomize/overlays/azd/${APP}/deployment.yaml" "$APP" "$VERSION"
188+ done
189+
190+ echo "Updating Kustomize kaito overlay manifests..."
191+ # kaito overlay uses full ghcr.io path
192+ update_full_image_ref "kustomize/overlays/kaito/ai-service.yaml" "ai-service" "$VERSION"
193+
194+ # =============================================================================
195+ # Update Helm chart values
196+ # =============================================================================
197+
198+ echo "Updating Helm chart values.yaml..."
199+ # Helm values.yaml uses separate 'tag' field: tag: "X.X.X"
200+ if [ -f "charts/aks-store-demo/values.yaml" ]; then
201+ sed -i -E "s|(tag: \")[^\"]+(\")|\1${VERSION}\2|g" "charts/aks-store-demo/values.yaml"
202+ echo "Updated Helm values.yaml"
203+ fi
204+
205+ echo "Manifest updates complete!"
206+
207+ - name : Commit and push changes
208+ run : |
209+ git config --global user.name "github-actions[bot]"
210+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
211+
212+ git add -A
213+ if git diff --staged --quiet; then
214+ echo "No changes to commit"
215+ else
216+ git commit -m "chore: update container image tags to ${{ steps.set-version.outputs.VERSION }}"
217+ git push
218+ fi
0 commit comments