Skip to content

Commit

Permalink
Also push MAJOR and MAJOR.MINOR tags when releasing
Browse files Browse the repository at this point in the history
Co-authored-by: Pavel Busko <[email protected]>
  • Loading branch information
phil9909 and pbusko committed Nov 17, 2021
1 parent b647143 commit f1c6752
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions octo/compute-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
8 changes: 5 additions & 3 deletions octo/create_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}",
},
},
{
Expand Down
2 changes: 2 additions & 0 deletions octo/package-buildpack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f1c6752

Please sign in to comment.