You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -746,44 +746,44 @@ Main idea is to automate bumping explicit tmp images in stack repo to allow test
746
746
747
747
**How It Works:**
748
748
749
-
For **dev branch commits**: When a commit is pushed to the configured development branch, it generates a version string like `tmp-cf3ebd52` and triggers the `update-service-version.yaml` workflow in the target repository. Commits that contain a GitHub Actions skip directive such as `[skip ci]`, `[ci skip]`, `[no ci]`, `[skip actions]`, `[actions skip]`, or the `skip-checks: true` trailer are ignored, including when this action is called from a `workflow_run` workflow.
749
+
For **dev branch commits**: When a commit is pushed to the configured development branch and the image build succeeds, it generates a version string like `tmp-cf3ebd52` and triggers the `update-service-version.yaml` workflow in the target repository.
750
750
751
-
For **tags**: When a tag is created, it extracts the tag name (e.g., `1.32.4`) and checks if the tagged commit exists in the configured development branch using `git merge-base --is-ancestor`. If the commit exists in that branch, it triggers the workflow with the tag name as version. If not, it skips triggering (assumes a hotfix released from `master` that has not been merged back yet). Tagged commits are also skipped if their commit message contains a GitHub Actions skip directive.
752
-
753
-
For **other branches**: The action skips version updates. This is useful when it is called from a `workflow_run` workflow that observes builds for every branch, but should only bump versions for the configured development branch and release tags.
751
+
For **tags**: When a tag is created, it extracts the tag name (e.g., `1.32.4`) and checks if the tagged commit exists in the configured development branch using `git merge-base --is-ancestor`. If the commit exists in that branch, it triggers the workflow with the tag name as version. If not, it skips triggering (assumes a hotfix released from `master` that has not been merged back yet).
754
752
755
753
#### Usage
756
754
757
-
```yaml .github/workflows/version_update.yaml
758
-
name: Trigger version update
755
+
```yaml .github/workflows/build_and_push.yaml
756
+
name: Build and push the image
759
757
760
758
on:
761
-
workflow_run:
762
-
# Name of the workflow that has to finish to trigger the version update
This example works when `Build and Test` runs on every push, including tags. The action itself only triggers version updates for commits on the configured `dev-branch` and for tags whose commits are already present in that branch.
786
+
Place the action after the step that builds and pushes the image. This way version updates are only triggered after a successful image build, and skipped workflows do not need any extra handling inside the action. In the calling workflow, gate the step so it only runs for the development branch and for tags.
echo "Version updates are skipped to avoid bumping an image version when the source image build was intentionally skipped." >> $GITHUB_STEP_SUMMARY
143
-
elif [[ "${{ steps.version.outputs.skip_reason }}" == "unsupported_source_ref" ]]; then
144
-
echo "ℹ️ Source ref is not the configured development branch and is not a release tag." >> $GITHUB_STEP_SUMMARY
145
-
echo "" >> $GITHUB_STEP_SUMMARY
146
-
echo "Version updates only run for commits on **${{ inputs.dev-branch }}** or for tags that point to commits already present in that branch." >> $GITHUB_STEP_SUMMARY
147
-
else
148
-
echo "⚠️ Tag **${{ steps.version.outputs.tag }}** does not exist in ${{ inputs.dev-branch }} branch" >> $GITHUB_STEP_SUMMARY
149
-
echo "" >> $GITHUB_STEP_SUMMARY
150
-
echo "This is likely a hotfix tag released directly from master." >> $GITHUB_STEP_SUMMARY
151
-
echo "Version updates are only triggered for tags that exist in the ${{ inputs.dev-branch }} branch." >> $GITHUB_STEP_SUMMARY
152
-
fi
97
+
echo "⚠️ Tag **${{ steps.version.outputs.tag }}** does not exist in ${{ inputs.dev-branch }} branch" >> $GITHUB_STEP_SUMMARY
98
+
echo "" >> $GITHUB_STEP_SUMMARY
99
+
echo "This is likely a hotfix tag released directly from master." >> $GITHUB_STEP_SUMMARY
100
+
echo "Version updates are only triggered for tags that exist in the ${{ inputs.dev-branch }} branch." >> $GITHUB_STEP_SUMMARY
0 commit comments