2016-10-05 19:37:32 +00:00
#!/bin/bash
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2022-04-25 07:54:40 +00:00
# This script generates the GitHub Release page and uploads all the binaries/etc to that page
2016-10-05 19:37:32 +00:00
# This is intended to be run on a new release tag in order to generate the github release page for that release
2016-12-24 04:11:05 +00:00
# The script expects the following env variables:
2016-12-23 11:46:04 +00:00
# VERSION_MAJOR: The major version of the tag to be released.
# VERSION_MINOR: The minor version of the tag to be released.
# VERSION_BUILD: The build version of the tag to be released.
2022-05-13 21:13:43 +00:00
# ISO_SHA256_AMD64: The sha 256 of the amd64 minikube-iso for the current release.
# ISO_SHA256_ARM64: The sha 256 of the arm64 minikube-iso for the current release.
2022-04-25 07:54:40 +00:00
# GITHUB_TOKEN: The GitHub API access token. Injected by the Jenkins credential provider.
2016-10-05 19:37:32 +00:00
2019-09-04 18:25:11 +00:00
set -eux -o pipefail
readonly VERSION = " ${ VERSION_MAJOR } . ${ VERSION_MINOR } . ${ VERSION_BUILD } "
2019-09-05 21:35:35 +00:00
readonly DEB_VERSION = " ${ VERSION /-/ \~ } "
readonly RPM_VERSION = " ${ DEB_VERSION } "
2019-09-18 13:34:36 +00:00
readonly ISO_BUCKET = "minikube/iso"
2019-09-04 18:25:11 +00:00
readonly TAGNAME = " v ${ VERSION } "
2018-05-30 21:25:24 +00:00
2019-09-04 18:25:11 +00:00
readonly GITHUB_ORGANIZATION = "kubernetes"
readonly GITHUB_REPO = "minikube"
readonly PROJECT_NAME = " ${ GITHUB_REPO } "
2016-10-05 19:37:32 +00:00
2021-09-17 19:02:17 +00:00
# installing golang to install github-release
./hack/jenkins/installers/check_install_golang.sh "/usr/local"
# installing latest version of github-release
2021-09-21 23:20:14 +00:00
#./hack/jenkins/installers/check_install_github_release.sh
2021-09-17 19:02:17 +00:00
2019-09-19 17:58:08 +00:00
RELEASE_FLAGS = ""
2019-09-05 22:24:45 +00:00
if ! [ [ ${ VERSION_BUILD } = ~ ^[ 0-9] +$ ] ] ; then
2019-09-19 17:58:08 +00:00
RELEASE_FLAGS = "-p" # Pre-release
2019-09-05 22:24:45 +00:00
fi
2020-12-14 19:42:05 +00:00
RELEASE_NOTES = $( perl -e " \$p=0; while(<>) { if(/^## Version ${ VERSION } -/) { \$p=1 } elsif (/^## Version/) { \$p=0 }; if (\$p) { print }} " < CHANGELOG.md)
2019-09-04 18:25:11 +00:00
if [ [ " ${ RELEASE_NOTES } " = "" ] ] ; then
RELEASE_NOTES = " (missing for ${ VERSION } ) "
fi
2016-10-05 19:37:32 +00:00
2019-09-19 17:58:08 +00:00
readonly DESCRIPTION = " 📣😀 **Please fill out our [fast 5-question survey](https://forms.gle/Gg3hG5ZySw8c1C24A)** so that we can learn how & why you use minikube, and what improvements we should make. Thank you! 💃🎉
## Release Notes
2019-02-24 19:50:30 +00:00
2019-09-04 18:25:11 +00:00
${ RELEASE_NOTES }
2016-10-05 19:37:32 +00:00
2019-09-04 18:25:11 +00:00
## Installation
2016-10-05 19:37:32 +00:00
2019-09-18 13:17:02 +00:00
See [ Getting Started] ( https://minikube.sigs.k8s.io/docs/start/)
2016-10-05 19:37:32 +00:00
2022-06-27 23:21:13 +00:00
## Binary Checksums
$( cat binary_checksums.txt)
## ISO Checksums
2016-10-05 19:37:32 +00:00
2022-05-13 21:13:43 +00:00
amd64: \` ${ ISO_SHA256_AMD64 } \`
arm64: \` ${ ISO_SHA256_ARM64 } \` "
2016-10-05 19:37:32 +00:00
# ================================================================================
# Deleting release from github before creating new one
2020-01-17 22:20:16 +00:00
github-release -v delete \
2019-09-04 18:25:11 +00:00
--user " ${ GITHUB_ORGANIZATION } " \
--repo " ${ GITHUB_REPO } " \
--tag " ${ TAGNAME } " \
|| true
2016-10-05 19:37:32 +00:00
# Creating a new release in github
2020-01-17 22:20:16 +00:00
github-release -v release ${ RELEASE_FLAGS } \
2019-09-04 18:25:11 +00:00
--user " ${ GITHUB_ORGANIZATION } " \
--repo " ${ GITHUB_REPO } " \
--tag " ${ TAGNAME } " \
2016-10-05 19:37:32 +00:00
--name " ${ TAGNAME } " \
--description " ${ DESCRIPTION } "
2020-04-22 21:59:54 +00:00
# ISO files are built from a separate process, and may not be included in this release
for path in $( gsutil ls " gs:// ${ ISO_BUCKET } /minikube-v ${ VERSION } * " || true ) ; do
gsutil cp " ${ path } " out/
2019-09-18 13:34:36 +00:00
done
2020-04-22 21:59:54 +00:00
# Upload all end-user assets other than preload files, as they are release independent
2025-01-14 23:30:38 +00:00
for file in $( find out \( -name "minikube[_-]*" -or -name "docker-machine-*" \) ) ; do
2018-06-27 21:59:15 +00:00
n = 0
until [ $n -ge 5 ]
do
2020-01-17 22:20:16 +00:00
github-release -v upload \
2019-09-04 18:25:11 +00:00
--user " ${ GITHUB_ORGANIZATION } " \
--repo " ${ GITHUB_REPO } " \
--tag " ${ TAGNAME } " \
2020-04-22 21:59:54 +00:00
--name " $( basename ${ file } ) " \
--file " ${ file } " && break
2019-09-18 13:38:50 +00:00
n = $(( n+1))
2018-06-27 21:59:15 +00:00
sleep 15
done
2017-10-27 00:01:57 +00:00
done