Skip to content

Commit 332a979

Browse files
committed
fix idempotency: skip if appVersion already up to date
1 parent 2f5d4e3 commit 332a979

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

.github/workflows/update-appversion.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,16 @@ jobs:
2323
git config user.email "github-actions[bot]@users.noreply.github.com"
2424
2525
- name: Bump versions in Chart.yaml
26+
id: bump
2627
run: |
2728
APP_VERSION="${{ github.event.client_payload.version }}"
29+
CURRENT_APP=$(grep '^appVersion:' charts/logtide/Chart.yaml | awk '{print $2}' | tr -d '"')
30+
31+
if [ "$CURRENT_APP" = "$APP_VERSION" ]; then
32+
echo "already at appVersion $APP_VERSION, skipping"
33+
echo "changed=false" >> $GITHUB_OUTPUT
34+
exit 0
35+
fi
2836
2937
CURRENT=$(grep '^version:' charts/logtide/Chart.yaml | awk '{print $2}')
3038
MAJOR=$(echo $CURRENT | cut -d. -f1)
@@ -37,22 +45,17 @@ jobs:
3745
3846
echo "chart: ${CURRENT} → ${NEW_CHART_VERSION}"
3947
echo "appVersion: ${APP_VERSION}"
48+
echo "changed=true" >> $GITHUB_OUTPUT
4049
4150
- name: Commit and push
42-
id: commit
51+
if: steps.bump.outputs.changed == 'true'
4352
run: |
4453
git add charts/logtide/Chart.yaml
45-
if git diff --staged --quiet; then
46-
echo "no changes, skipping"
47-
echo "changed=false" >> $GITHUB_OUTPUT
48-
else
49-
git commit -m "bump to logtide v${{ github.event.client_payload.version }}"
50-
git push origin main
51-
echo "changed=true" >> $GITHUB_OUTPUT
52-
fi
54+
git commit -m "bump to logtide v${{ github.event.client_payload.version }}"
55+
git push origin main
5356
5457
- name: Trigger release workflow
55-
if: steps.commit.outputs.changed == 'true'
58+
if: steps.bump.outputs.changed == 'true'
5659
run: gh workflow run release.yaml --ref main
5760
env:
5861
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)