From f1c6752f2fa4171a1c2378f0700731a4f93d0d50 Mon Sep 17 00:00:00 2001 From: Philipp Stehle Date: Wed, 17 Nov 2021 16:43:27 +0100 Subject: [PATCH] Also push MAJOR and MAJOR.MINOR tags when releasing Co-authored-by: Pavel Busko --- octo/compute-version.sh | 5 +++++ octo/create_package.go | 8 +++++--- octo/package-buildpack.sh | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/octo/compute-version.sh b/octo/compute-version.sh index a6380c2e..4781afd5 100755 --- a/octo/compute-version.sh +++ b/octo/compute-version.sh @@ -10,6 +10,11 @@ else VERSION=$(git rev-parse --short HEAD) fi +MAJOR_VERSION="$(echo "${VERSION}" | awk -F '.' '{print $1 }')" +MINOR_VERSION="$(echo "${VERSION}" | awk -F '.' '{print $1 "." $2 }')" + +echo "::set-output name=version_major::${MAJOR_VERSION}" +echo "::set-output name=version_minor::${MINOR_VERSION}" echo "::set-output name=version::${VERSION}" echo "Selected ${VERSION} from * ref: ${GITHUB_REF} diff --git a/octo/create_package.go b/octo/create_package.go index a3321b35..bab6547a 100644 --- a/octo/create_package.go +++ b/octo/create_package.go @@ -117,9 +117,11 @@ func ContributeCreatePackage(descriptor Descriptor) (*Contribution, error) { Name: "Package Buildpack", Run: StatikString("/package-buildpack.sh"), Env: map[string]string{ - "PACKAGE": descriptor.Package.Repository, - "PUBLISH": "true", - "VERSION": "${{ steps.version.outputs.version }}", + "PACKAGE": descriptor.Package.Repository, + "PUBLISH": "true", + "VERSION": "${{ steps.version.outputs.version }}", + "VERSION_MAJOR": "${{ steps.version.outputs.version_major }}", + "VERSION_MINOR": "${{ steps.version.outputs.version_minor }}", }, }, { diff --git a/octo/package-buildpack.sh b/octo/package-buildpack.sh index 034de05c..1f0eae10 100755 --- a/octo/package-buildpack.sh +++ b/octo/package-buildpack.sh @@ -8,6 +8,8 @@ if [[ -n "${PUBLISH+x}" ]]; then --config "${HOME}"/package.toml \ --publish + crane tag "${PACKAGE}:${VERSION}" "${VERSION_MINOR}" + crane tag "${PACKAGE}:${VERSION}" "${VERSION_MAJOR}" crane tag "${PACKAGE}:${VERSION}" latest echo "::set-output name=digest::$(crane digest "${PACKAGE}:${VERSION}")" else