mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 15:02:45 +00:00
releases: Assume VERSION has the correct version to be released
This is done in order to avoid having to push a commit to the main branch, which is against the defined rules on GitHub. By doing this, we need to educate ourselves to always bump the VERSION file as soon as a release is cut out. As a side effect of this change, we can drop the release-major and release-minor workflows, as those are not needed anymore. Fixes: #9064 - part IV Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
8ce50269fe
commit
12578f11bc
10
.github/workflows/release-major.yaml
vendored
10
.github/workflows/release-major.yaml
vendored
@ -1,10 +0,0 @@
|
||||
name: Major Release
|
||||
on:
|
||||
workflow_dispatch
|
||||
|
||||
jobs:
|
||||
major-release:
|
||||
uses: ./.github/workflows/release.yaml
|
||||
with:
|
||||
release-type: major
|
||||
secrets: inherit
|
10
.github/workflows/release-minor.yaml
vendored
10
.github/workflows/release-minor.yaml
vendored
@ -1,10 +0,0 @@
|
||||
name: Minor Release
|
||||
on:
|
||||
workflow_dispatch
|
||||
|
||||
jobs:
|
||||
minor-release:
|
||||
uses: ./.github/workflows/release.yaml
|
||||
with:
|
||||
release-type: minor
|
||||
secrets: inherit
|
14
.github/workflows/release.yaml
vendored
14
.github/workflows/release.yaml
vendored
@ -1,10 +1,6 @@
|
||||
name: Release Kata Containers
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
release-type:
|
||||
required: true
|
||||
type: string
|
||||
workflow_dispatch
|
||||
|
||||
jobs:
|
||||
release:
|
||||
@ -19,13 +15,9 @@ jobs:
|
||||
|
||||
- name: Get the new release version
|
||||
run: |
|
||||
release_version=$(./tools/packaging/release/release.sh next-release-version)
|
||||
release_version=$(./tools/packaging/release/release.sh release-version)
|
||||
echo "RELEASE_VERSION=$release_version" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Update VERSION file
|
||||
run: |
|
||||
./tools/packaging/release/release.sh update-version-file
|
||||
|
||||
- name: Create a new release
|
||||
run: |
|
||||
./tools/packaging/release/release.sh create-new-release
|
||||
@ -88,7 +80,7 @@ jobs:
|
||||
|
||||
- name: Get the image tags
|
||||
run: |
|
||||
release_version=$(./tools/packaging/release/release.sh next-release-version)
|
||||
release_version=$(./tools/packaging/release/release.sh release-version)
|
||||
echo "KATA_DEPLOY_IMAGE_TAGS=$release_version latest" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Push multi-arch manifest
|
||||
|
@ -10,14 +10,11 @@ This document lists the tasks required to create a Kata Release.
|
||||
### Check GitHub Actions
|
||||
|
||||
We make use of [GitHub actions](https://github.com/features/actions) in the
|
||||
[minor](https://github.com/kata-containers/kata-containers/actions/workflows/release-minor.yaml)
|
||||
and
|
||||
[major](https://github.com/kata-containers/kata-containers/actions/workflows/release-major.yaml)
|
||||
files from the
|
||||
`kata-containers/kata-containers` repository to build and upload release
|
||||
artifacts.
|
||||
[release](https://github.com/kata-containers/kata-containers/actions/workflows/release.yaml)
|
||||
file from the `kata-containers/kata-containers` repository to build and upload
|
||||
release artifacts.
|
||||
|
||||
Those actions are manually triggered and are responsible for generating a new
|
||||
The action is manually triggered and is responsible for generating a new
|
||||
release (including a new tag), pushing those to the
|
||||
`kata-containers/kata-containers` repository.
|
||||
|
||||
|
@ -22,7 +22,6 @@ IFS=' ' read -a REGISTRIES <<< "${KATA_DEPLOY_REGISTRIES}"
|
||||
GH_TOKEN="${GH_TOKEN:-}"
|
||||
ARCHITECTURE="${ARCHITECTURE:-}"
|
||||
KATA_STATIC_TARBALL="${KATA_STATIC_TARBALL:-}"
|
||||
RELEASE_TYPE="${RELEASE_TYPE:-}"
|
||||
|
||||
function _die()
|
||||
{
|
||||
@ -35,7 +34,6 @@ function _check_required_env_var()
|
||||
local env_var
|
||||
|
||||
case ${1} in
|
||||
RELEASE_TYPE) env_var="${RELEASE_TYPE}" ;;
|
||||
RELEASE_VERSION) env_var="${RELEASE_VERSION}" ;;
|
||||
GH_TOKEN) env_var="${GH_TOKEN}" ;;
|
||||
ARCHITECTURE) env_var="${ARCHITECTURE}" ;;
|
||||
@ -51,56 +49,9 @@ function _check_required_env_var()
|
||||
return 0
|
||||
}
|
||||
|
||||
function _next_release_version()
|
||||
function _release_version()
|
||||
{
|
||||
_check_required_env_var "RELEASE_TYPE"
|
||||
|
||||
local current_release=$(cat "${repo_root_dir}/VERSION")
|
||||
local current_major
|
||||
local current_everything_else
|
||||
local next_major
|
||||
local next_minor
|
||||
|
||||
IFS="." read current_major current_minor current_everything_else <<< ${current_release}
|
||||
|
||||
case ${RELEASE_TYPE} in
|
||||
major)
|
||||
next_major=$(expr $current_major + 1)
|
||||
next_minor=0
|
||||
;;
|
||||
minor)
|
||||
next_major=${current_major}
|
||||
# TODO: As we're moving from an alpha release to the
|
||||
# new scheme, this check is needed for the very first
|
||||
# release, after that it can be dropped and only the
|
||||
# else part can be kept.
|
||||
if grep -qE "alpha|rc" <<< ${current_everything_else}; then
|
||||
next_minor=${current_minor}
|
||||
else
|
||||
next_minor=$(expr $current_minor + 1)
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
_die "${RELEASE_TYPE} is not a valid release type, it must be: major or minor"
|
||||
;;
|
||||
esac
|
||||
|
||||
next_release_number="${next_major}.${next_minor}.0"
|
||||
echo "${next_release_number}"
|
||||
}
|
||||
|
||||
function _update_version_file()
|
||||
{
|
||||
_check_required_env_var "RELEASE_VERSION"
|
||||
|
||||
git config user.email "katacontainersbot@gmail.com"
|
||||
git config user.name "Kata Containers Bot"
|
||||
|
||||
echo "${RELEASE_VERSION}" > "${repo_root_dir}/VERSION"
|
||||
git diff
|
||||
git add "${repo_root_dir}/VERSION"
|
||||
git commit -s -m "release: Kata Containers ${RELEASE_VERSION}"
|
||||
git push
|
||||
cat "${repo_root_dir}/VERSION"
|
||||
}
|
||||
|
||||
function _create_our_own_notes()
|
||||
@ -191,7 +142,7 @@ function _upload_kata_static_tarball()
|
||||
_check_required_env_var "ARCHITECTURE"
|
||||
_check_required_env_var "KATA_STATIC_TARBALL"
|
||||
|
||||
RELEASE_VERSION="$(_next_release_version)"
|
||||
RELEASE_VERSION="$(_release_version)"
|
||||
|
||||
new_tarball_name="kata-static-${RELEASE_VERSION}-${ARCHITECTURE}.tar.xz"
|
||||
mv ${KATA_STATIC_TARBALL} "${new_tarball_name}"
|
||||
@ -201,7 +152,7 @@ function _upload_kata_static_tarball()
|
||||
|
||||
function _upload_versions_yaml_file()
|
||||
{
|
||||
RELEASE_VERSION="$(_next_release_version)"
|
||||
RELEASE_VERSION="$(_release_version)"
|
||||
|
||||
versions_file="kata-containers-${RELEASE_VERSION}-versions.yaml"
|
||||
cp "${repo_root_dir}/versions.yaml" ${versions_file}
|
||||
@ -212,7 +163,7 @@ function _upload_vendored_code_tarball()
|
||||
{
|
||||
_check_required_env_var "GH_TOKEN"
|
||||
|
||||
RELEASE_VERSION="$(_next_release_version)"
|
||||
RELEASE_VERSION="$(_release_version)"
|
||||
|
||||
vendored_code_tarball="kata-containers-${RELEASE_VERSION}-vendor.tar.gz"
|
||||
bash -c "${repo_root_dir}/tools/packaging/release/generate_vendor.sh ${vendored_code_tarball}"
|
||||
@ -223,7 +174,7 @@ function _upload_libseccomp_tarball()
|
||||
{
|
||||
_check_required_env_var "GH_TOKEN"
|
||||
|
||||
RELEASE_VERSION="$(_next_release_version)"
|
||||
RELEASE_VERSION="$(_release_version)"
|
||||
|
||||
GOPATH=${HOME}/go ./ci/install_yq.sh
|
||||
|
||||
@ -245,8 +196,7 @@ function main()
|
||||
|
||||
case "${action}" in
|
||||
publish-multiarch-manifest) _publish_multiarch_manifest ;;
|
||||
update-version-file) _update_version_file ;;
|
||||
next-release-version) _next_release_version;;
|
||||
release-version) _release_version;;
|
||||
create-new-release) _create_new_release ;;
|
||||
upload-kata-static-tarball) _upload_kata_static_tarball ;;
|
||||
upload-versions-yaml-file) _upload_versions_yaml_file ;;
|
||||
|
Loading…
Reference in New Issue
Block a user