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.
# This script generates the Github Release page and uploads all the binaries/etc to that page
# 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.
2017-06-20 15:45:30 +00:00
# ISO_SHA256: The sha 256 of the minikube-iso for the current release.
2016-12-23 11:46:04 +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
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
2019-09-18 13:34:36 +00:00
RELEASE_NOTES = $( perl -e " \$p=0; while(<>) { if(/^## Version ${ VERSION } -/) { \$p=1 } elsif (/^##/) { \$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
2019-09-04 18:25:11 +00:00
## ISO Checksum
2016-10-05 19:37:32 +00:00
2019-09-04 18:25:11 +00:00
\` ${ ISO_SHA256 } \` "
2016-10-05 19:37:32 +00:00
# ================================================================================
# Deleting release from github before creating new one
2019-09-04 18:25:11 +00:00
github-release delete \
--user " ${ GITHUB_ORGANIZATION } " \
--repo " ${ GITHUB_REPO } " \
--tag " ${ TAGNAME } " \
|| true
2016-10-05 19:37:32 +00:00
# Creating a new release in github
2019-09-05 22:24:45 +00:00
github-release 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 } "
# Uploading the files into github
2017-10-27 00:01:57 +00:00
FILES_TO_UPLOAD = (
'minikube-linux-amd64'
'minikube-linux-amd64.sha256'
'minikube-darwin-amd64'
'minikube-darwin-amd64.sha256'
2019-03-10 09:46:19 +00:00
'minikube-windows-amd64.exe'
'minikube-windows-amd64.exe.sha256'
2017-10-27 00:01:57 +00:00
'minikube-installer.exe'
" minikube_ ${ DEB_VERSION } .deb "
2019-03-07 06:18:27 +00:00
" minikube- ${ RPM_VERSION } .rpm "
2017-10-27 00:01:57 +00:00
'docker-machine-driver-kvm2'
2019-03-24 15:31:53 +00:00
'docker-machine-driver-kvm2.sha256'
2017-10-27 00:01:57 +00:00
'docker-machine-driver-hyperkit'
2019-03-24 15:31:53 +00:00
'docker-machine-driver-hyperkit.sha256'
2017-10-27 00:01:57 +00:00
)
2019-09-18 13:34:36 +00:00
# ISO files are special, as they are generated pre-release tagging
ISO_FILES = ( " minikube-v ${ VERSION } .iso " " minikube-v ${ VERSION } .iso.sha256 " )
for DOWNLOAD in " ${ ISO_FILES [@] } "
do
gsutil cp " gs:// ${ ISO_BUCKET } / ${ DOWNLOAD } " out/ \
2019-09-18 13:38:50 +00:00
&& FILES_TO_UPLOAD += ( " ${ DOWNLOAD } " ) \
2019-09-18 13:34:36 +00:00
|| echo " ${ DOWNLOAD } was not generated for this release "
done
2017-10-27 00:01:57 +00:00
for UPLOAD in " ${ FILES_TO_UPLOAD [@] } "
do
2018-06-27 21:59:15 +00:00
n = 0
until [ $n -ge 5 ]
do
2019-09-04 18:25:11 +00:00
github-release upload \
--user " ${ GITHUB_ORGANIZATION } " \
--repo " ${ GITHUB_REPO } " \
--tag " ${ TAGNAME } " \
--name " $UPLOAD " \
--file " out/ $UPLOAD " && 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