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

feat(gha): pass version as cloudsmith tags #12175

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ jobs:
ARTIFACT_VERSION: ${{ matrix.artifact-version }}
ARTIFACT_TYPE: ${{ matrix.artifact-type }}
ARTIFACT: ${{ matrix.artifact }}
INPUT_VERSION: ${{ github.event.inputs.version }}
PACKAGE_TYPE: ${{ matrix.package }}
KONG_RELEASE_LABEL: ${{ needs.metadata.outputs.release-label }}
VERBOSE: ${{ runner.debug == '1' && '1' || '' }}
Expand All @@ -649,6 +650,17 @@ jobs:
run: |
sha256sum bazel-bin/pkg/*

# set the version input as tags passed to release-scripts
# note: release-scripts rejects user tags if missing internal flag
#
# this can be a comma-sepratated list of tags to apply
if [[ "$OFFICIAL_RELEASE" == 'false' ]]; then
if echo "$INPUT_VERSION" | grep -qs -E 'rc|alpha|beta|nightly'; then
PACKAGE_TAGS="$INPUT_VERSION"
export PACKAGE_TAGS
fi
fi

scripts/release-kong.sh

release-images:
Expand Down
22 changes: 18 additions & 4 deletions scripts/release-kong.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,32 @@ function push_package () {
dist_version="--dist-version jammy"
fi

# test for sanitized github actions input
if [[ -n "$(echo "$PACKAGE_TAGS" | tr -d 'a-zA-Z0-9._,')" ]]; then
echo 'invalid characters in PACKAGE_TAGS'
echo "passed to script: ${PACKAGE_TAGS}"
tags=''
else
tags="$PACKAGE_TAGS"
fi

set -x
release_args=''

if [ -n "${tags:-}" ]; then
release_args="${release_args} --tags ${tags}"
fi

local release_args="--package-type gateway"
release_args="${release_args} --package-type gateway"
if [[ "$EDITION" == "enterprise" ]]; then
release_args="$release_args --enterprise"
release_args="${release_args} --enterprise"
fi

# pre-releases go to `/internal/`
if [[ "$OFFICIAL_RELEASE" == "true" ]]; then
release_args="$release_args --publish"
release_args="${release_args} --publish"
else
release_args="$release_args --internal"
release_args="${release_args} --internal"
fi

docker run \
Expand Down
Loading