|
79 | 79 | needs: publish-container-image |
80 | 80 | permissions: |
81 | 81 | contents: write |
| 82 | + pull-requests: write |
82 | 83 |
|
83 | 84 | steps: |
84 | 85 | - name: Checkout code |
@@ -192,17 +193,52 @@ jobs: |
192 | 193 | # kaito overlay uses full ghcr.io path |
193 | 194 | update_full_image_ref "kustomize/overlays/kaito/ai-service.yaml" "ai-service" "$VERSION" |
194 | 195 |
|
| 196 | + # ============================================================================= |
| 197 | + # Update Helm chart appVersion |
| 198 | + # ============================================================================= |
| 199 | +
|
| 200 | + echo "Updating Helm chart appVersion..." |
| 201 | + # Image tags in values.yaml default to Chart.AppVersion, so bump appVersion. |
| 202 | + # The chart's own 'version' field follows independent semver and is left untouched. |
| 203 | + CHART_FILE="charts/aks-store-demo/Chart.yaml" |
| 204 | + if [ -f "$CHART_FILE" ]; then |
| 205 | + sed -i "s|^appVersion:.*|appVersion: \"${VERSION}\"|" "$CHART_FILE" |
| 206 | + echo "Updated appVersion in ${CHART_FILE}" |
| 207 | + fi |
| 208 | +
|
195 | 209 | echo "Manifest updates complete!" |
196 | 210 |
|
197 | | - - name: Commit and push changes |
| 211 | + - name: Commit, push branch, and open PR |
| 212 | + env: |
| 213 | + GH_TOKEN: ${{ github.token }} |
198 | 214 | run: | |
| 215 | + set -euo pipefail |
| 216 | +
|
| 217 | + VERSION="${{ steps.set-version.outputs.VERSION }}" |
| 218 | + BRANCH="chore/update-image-tags-${VERSION}" |
| 219 | + HEAD_REF="${{ github.repository_owner }}:${BRANCH}" |
| 220 | +
|
199 | 221 | git config --global user.name "github-actions[bot]" |
200 | 222 | git config --global user.email "github-actions[bot]@users.noreply.github.com" |
201 | 223 |
|
| 224 | + git checkout -b "$BRANCH" |
202 | 225 | git add -A |
| 226 | +
|
203 | 227 | if git diff --staged --quiet; then |
204 | 228 | echo "No changes to commit" |
| 229 | + exit 0 |
| 230 | + fi |
| 231 | +
|
| 232 | + git commit -m "chore: update container image tags to ${VERSION}" |
| 233 | + git push -u origin "$BRANCH" --force-with-lease |
| 234 | +
|
| 235 | + # Create PR only if one doesn't already exist for this head branch |
| 236 | + if gh pr list --state open --head "$BRANCH" --json number --jq 'length > 0' | grep -q true; then |
| 237 | + echo "PR already exists for branch $BRANCH" |
205 | 238 | else |
206 | | - git commit -m "chore: update container image tags to ${{ steps.set-version.outputs.VERSION }}" |
207 | | - git push origin HEAD:main |
| 239 | + gh pr create \ |
| 240 | + --base "${{ github.event.repository.default_branch }}" \ |
| 241 | + --head "$HEAD_REF" \ |
| 242 | + --title "chore: update container image tags to ${VERSION}" \ |
| 243 | + --body "Automated manifest image tag update for release ${VERSION}." |
208 | 244 | fi |
0 commit comments