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

fix(build): always tag image versions #776

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
31 changes: 16 additions & 15 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,24 @@ done

# === Setup tags

IMAGE_VERSION=$(jq -r '.version' package.json)
IMAGE_VERSION_MAJOR=$(echo "$IMAGE_VERSION" | cut -d '.' -f 1)
IMAGE_VERSION_MINOR=$(echo "$IMAGE_VERSION" | cut -d '.' -f 1,2)
TAGS+=(
"${IMAGE_VERSION}"
"${IMAGE_VERSION_MAJOR}"
"${IMAGE_VERSION_MINOR}"
)
# get image specific tags
# shellcheck disable=SC1090
source "$BUILD_ENV_FILE"
eval "$(declare -p IMAGE_TAGS)"
TAGS+=(
"${IMAGE_TAGS[@]}"
)

# publish to Dockerhub
if [ "$PUBLISH" == true ]; then
IMAGE_VERSION=$(jq -r '.version' package.json)
IMAGE_VERSION_MAJOR=$(echo "$IMAGE_VERSION" | cut -d '.' -f 1)
IMAGE_VERSION_MINOR=$(echo "$IMAGE_VERSION" | cut -d '.' -f 1,2)
TAGS+=(
"${IMAGE_VERSION}"
"${IMAGE_VERSION_MAJOR}"
"${IMAGE_VERSION_MINOR}"
)
# get image specific tags
# shellcheck disable=SC1090
source "$BUILD_ENV_FILE"
eval "$(declare -p IMAGE_TAGS)"
TAGS+=(
"${IMAGE_TAGS[@]}"
)
BUILD_ARGS+=("--push")
# build/test in CI
elif [ "$GITHUB_ACTIONS" == true ]; then
Expand Down