mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 00:37:24 +00:00
Merge pull request #108 from jcvenegas/github-release
release: Create github release after create tag.
This commit is contained in:
commit
6e69deba7f
@ -5,6 +5,8 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
|
[ -z "${DEBUG}" ] || set -x
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
@ -20,6 +20,8 @@ readonly URL_RAW_FILE="https://raw.githubusercontent.com/${OWNER}"
|
|||||||
#The runtime version is used as reference of latest release
|
#The runtime version is used as reference of latest release
|
||||||
readonly kata_version=$(curl -Ls "${URL_RAW_FILE}/runtime/${commit}/VERSION" | grep -v -P "^#")
|
readonly kata_version=$(curl -Ls "${URL_RAW_FILE}/runtime/${commit}/VERSION" | grep -v -P "^#")
|
||||||
|
|
||||||
|
source "${script_dir}/../scripts/lib.sh"
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
|
|
||||||
cat <<EOT
|
cat <<EOT
|
||||||
@ -103,16 +105,31 @@ tag_repos() {
|
|||||||
|
|
||||||
push_tags() {
|
push_tags() {
|
||||||
info "Pushing tags to repos"
|
info "Pushing tags to repos"
|
||||||
|
build_hub
|
||||||
for repo in "${repos[@]}"; do
|
for repo in "${repos[@]}"; do
|
||||||
pushd "${repo}" >> /dev/null
|
pushd "${repo}" >> /dev/null
|
||||||
tag="$kata_version"
|
tag="$kata_version"
|
||||||
[[ "packaging" == "${repo}" ]] && tag="${tag}-kernel-config"
|
[[ "packaging" == "${repo}" ]] && tag="${tag}-kernel-config"
|
||||||
info "Creating tag ${tag} for ${repo}"
|
info "Push tag ${tag} for ${repo}"
|
||||||
git push origin "${tag}"
|
git push origin "${tag}"
|
||||||
|
create_github_release "${PWD}" "${tag}"
|
||||||
popd >> /dev/null
|
popd >> /dev/null
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_github_release(){
|
||||||
|
repo_dir=${1:-}
|
||||||
|
tag=${2:-}
|
||||||
|
[ -d "${repo_dir}" ] || die "No repository directory"
|
||||||
|
[ -n "${tag}" ] || die "No repository directory"
|
||||||
|
if ! "${hub_bin}" release | grep "${tag}"; then
|
||||||
|
info "Creating Github release"
|
||||||
|
"${hub_bin }" -C "${repo_dir}" release create -m "${PROJECT} ${tag}" "${tag}"
|
||||||
|
else
|
||||||
|
info "Github release already created"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
while getopts "hp" opt; do
|
while getopts "hp" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
h) usage && exit 0 ;;
|
h) usage && exit 0 ;;
|
||||||
|
@ -13,42 +13,18 @@ readonly script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||||||
readonly script_name="$(basename "${BASH_SOURCE[0]}")"
|
readonly script_name="$(basename "${BASH_SOURCE[0]}")"
|
||||||
|
|
||||||
readonly tmp_dir=$(mktemp -t -d pr-bump.XXXX)
|
readonly tmp_dir=$(mktemp -t -d pr-bump.XXXX)
|
||||||
readonly hub_bin="${tmp_dir}/hub-bin"
|
|
||||||
readonly organization="kata-containers"
|
readonly organization="kata-containers"
|
||||||
PUSH="false"
|
PUSH="false"
|
||||||
GOPATH=${GOPATH:-${HOME}/go}
|
GOPATH=${GOPATH:-${HOME}/go}
|
||||||
|
|
||||||
|
source "${script_dir}/../scripts/lib.sh"
|
||||||
|
|
||||||
cleanup (){
|
cleanup (){
|
||||||
[ -d "${tmp_dir}" ] && rm -rf "${tmp_dir}"
|
[ -d "${tmp_dir}" ] && rm -rf "${tmp_dir}"
|
||||||
}
|
}
|
||||||
|
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
die()
|
|
||||||
{
|
|
||||||
msg="$*"
|
|
||||||
echo "ERROR: ${msg}" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
info()
|
|
||||||
{
|
|
||||||
msg="$*"
|
|
||||||
echo "INFO: ${msg}" >&2
|
|
||||||
}
|
|
||||||
|
|
||||||
build_hub() {
|
|
||||||
info "Get hub"
|
|
||||||
local hub_repo="github.com/github/hub"
|
|
||||||
local hub_repo_dir="${GOPATH}/src/${hub_repo}"
|
|
||||||
[ -d "${hub_repo_dir}" ]|| git clone --quiet --depth 1 "https://${hub_repo}.git" "${hub_repo_dir}"
|
|
||||||
pushd "${hub_repo_dir}" >> /dev/null
|
|
||||||
git checkout master
|
|
||||||
git pull
|
|
||||||
./script/build -o "${hub_bin}"
|
|
||||||
popd >> /dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
get_changes() {
|
get_changes() {
|
||||||
local current_version=$1
|
local current_version=$1
|
||||||
[ -n "${current_version}" ] || die "current version not provided"
|
[ -n "${current_version}" ] || die "current version not provided"
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
|
export GOPATH=${GOPATH:-${HOME}/go}
|
||||||
readonly kata_arch_sh="${GOPATH}/src/github.com/kata-containers/tests/.ci/kata-arch.sh"
|
readonly kata_arch_sh="${GOPATH}/src/github.com/kata-containers/tests/.ci/kata-arch.sh"
|
||||||
|
hub_bin="${tmp_dir}/hub-bin"
|
||||||
|
|
||||||
get_kata_arch(){
|
get_kata_arch(){
|
||||||
go get -u github.com/kata-containers/tests || true
|
go get -u github.com/kata-containers/tests || true
|
||||||
@ -61,3 +63,21 @@ get_repo_hash(){
|
|||||||
popd >> /dev/null
|
popd >> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_hub() {
|
||||||
|
info "Get hub"
|
||||||
|
|
||||||
|
if cmd=$(command -v hub); then
|
||||||
|
hub_bin="${cmd}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local hub_repo="github.com/github/hub"
|
||||||
|
local hub_repo_dir="${GOPATH}/src/${hub_repo}"
|
||||||
|
[ -d "${hub_repo_dir}" ]|| git clone --quiet --depth 1 "https://${hub_repo}.git" "${hub_repo_dir}"
|
||||||
|
pushd "${hub_repo_dir}" >> /dev/null
|
||||||
|
git checkout master
|
||||||
|
git pull
|
||||||
|
./script/build -o "${hub_bin}"
|
||||||
|
popd >> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user