Skip to content

Commit

Permalink
feat(gha): pass version as cloudsmith tags
Browse files Browse the repository at this point in the history
(cherry picked from commit 851ebcf5e65d6ba12aa5026a453e10f978f95ceb)
  • Loading branch information
curiositycasualty committed Dec 12, 2023
1 parent 2adad05 commit 0b05000
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
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

0 comments on commit 0b05000

Please sign in to comment.