Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: tag image on branch #1

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading