Skip to content

Commit

Permalink
Merge pull request #1 from ii/tag-image-on-branch
Browse files Browse the repository at this point in the history
chore: tag image on branch
  • Loading branch information
BobyMCbobs authored Feb 7, 2024
2 parents b7725cb + 46d30b6 commit fbd15e6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,19 @@ jobs:
# Generate a timestamp for creating an image version history
TIMESTAMP="$(date +%Y%m%d)"
COREOS_VERSION="stable"
BRANCH="${GITHUB_REF#refs/heads/}"
COMMIT_TAGS=()
BRANCH_TAGS=()
BUILD_TAGS=()
# Have tags for tracking builds during pull request
SHA_SHORT="${GITHUB_SHA::7}"
COMMIT_TAGS+=("pr-${{ github.event.number }}-${COREOS_VERSION}")
COMMIT_TAGS+=("${SHA_SHORT}-${COREOS_VERSION}")
BRANCH_TAGS+=("${COREOS_VERSION}-${BRANCH}")
BUILD_TAGS=("${COREOS_VERSION}" "${COREOS_VERSION}-${TIMESTAMP}")
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
Expand All @@ -40,6 +44,15 @@ jobs:
done
alias_tags=("${COMMIT_TAGS[@]}")
elif [[ "${BRANCH}" != "main" ]]; then
echo "Generated the following branch tags: "
for TAG in "${BRANCH_TAGS[@]}"; do
echo "${TAG}"
done
alias_tags=("${BRANCH_TAGS[@]}")
else
alias_tags=("${BUILD_TAGS[@]}")
fi
Expand Down

0 comments on commit fbd15e6

Please sign in to comment.