Skip to content

Commit

Permalink
Fix setting base tag on branches
Browse files Browse the repository at this point in the history
  • Loading branch information
discordianfish committed Oct 4, 2023
1 parent b63e63e commit b7c6aec
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/build-push-agents-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,18 @@ jobs:
- name: Find base tag
id: base-tag
run: |
semver=${{ steps.meta.outputs.version }}
major=${semver%%.*}
# If not a semver (e.g branch name), use main as base tag
if [[ $major == "$semver" ]]; then
ref=${{ steps.meta.outputs.version }}
# on release-* branches, use branch as base tag
if [[ $ref == release-* ]]; then
echo "tag=$ref" >> "$GITHUB_OUTPUT"
exit 0
fi
# on any other branch, use main as base tag
if [[ ! $ref =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "tag=main" >> "$GITHUB_OUTPUT"
exit 0
fi
major=${semver%%.*}
minor_and_patch=${semver#*.}
minor=${minor_and_patch%%.*}
echo "tag=v${major}.${minor}" >> "$GITHUB_OUTPUT"
Expand Down

0 comments on commit b7c6aec

Please sign in to comment.