forked from LaconicNetwork/kompose
Update release script (#1535)
Signed-off-by: Charlie Drage <charlie@charliedrage.com> Signed-off-by: Charlie Drage <charlie@charliedrage.com>
This commit is contained in:
+10
-133
@@ -23,11 +23,7 @@ usage() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Requirements:"
|
echo "Requirements:"
|
||||||
echo " git"
|
echo " git"
|
||||||
echo " hub"
|
echo " gh"
|
||||||
echo " github-release"
|
|
||||||
echo " github_changelog_generator"
|
|
||||||
echo " fpm"
|
|
||||||
echo " GITHUB_TOKEN in your env variable"
|
|
||||||
echo " "
|
echo " "
|
||||||
echo "Not only that, but you must have permission for:"
|
echo "Not only that, but you must have permission for:"
|
||||||
echo " Tagging releases within Github"
|
echo " Tagging releases within Github"
|
||||||
@@ -41,30 +37,6 @@ requirements() {
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! hash github-release 2>/dev/null; then
|
|
||||||
echo "ERROR: No $GOPATH/bin/github-release. Please run 'go get -v github.com/aktau/github-release'"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! hash github_changelog_generator 2>/dev/null; then
|
|
||||||
echo "ERROR: github_changelog_generator required to generate the change log. Please run 'gem install github_changelog_generator"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! hash fpm 2>/dev/null; then
|
|
||||||
echo "ERROR: fpm required to generate deb/rpm packages. Please run 'gem install fpm"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! hash hub 2>/dev/null; then
|
|
||||||
echo "ERROR: Hub needed in order to create the relevant PR's. Please install hub @ https://github.com/github/hub"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "$GITHUB_TOKEN" ]]; then
|
|
||||||
echo "ERROR: export GITHUB_TOKEN=yourtoken needed for using github-release"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make sure that upstream had been added to the repo
|
# Make sure that upstream had been added to the repo
|
||||||
@@ -103,62 +75,15 @@ replaceversion() {
|
|||||||
|
|
||||||
echo "Replaced version in build/VERSION"
|
echo "Replaced version in build/VERSION"
|
||||||
sed -i "s/$1/$2/g" build/VERSION || gsed -i "s/$1/$2/g" build/VERSION
|
sed -i "s/$1/$2/g" build/VERSION || gsed -i "s/$1/$2/g" build/VERSION
|
||||||
}
|
|
||||||
|
|
||||||
changelog() {
|
|
||||||
echo "Generating changelog using github-changelog-generator"
|
|
||||||
github_changelog_generator --user $UPSTREAM_REPO --project $CLI -t $GITHUB_TOKEN --future-release v$1
|
|
||||||
}
|
|
||||||
|
|
||||||
changelog_github() {
|
echo "Ignore above errors if you're using macOS"
|
||||||
touch changes.txt
|
|
||||||
echo "Write your GitHub changelog here" >> changes.txt
|
|
||||||
$EDITOR changes.txt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build_binaries() {
|
build_binaries() {
|
||||||
make cross
|
make cross
|
||||||
}
|
}
|
||||||
|
|
||||||
build_packages() {
|
|
||||||
# fpm is required installed (https://github.com/jordansissel/fpm)
|
|
||||||
BIN_DIR="./bin/"
|
|
||||||
PKG_DIR="./bin/"
|
|
||||||
|
|
||||||
mkdir -p $PKG_DIR
|
|
||||||
|
|
||||||
# package version, use current date by default (if build from master)
|
|
||||||
PKG_VERSION=$1
|
|
||||||
|
|
||||||
# create packages using fpm
|
|
||||||
fpm -h >/dev/null 2>&1 || {
|
|
||||||
echo "ERROR: fpm (https://github.com/jordansissel/fpm) is not installed. Can't create linux packages"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
TMP_DIR=$(mktemp -d)
|
|
||||||
mkdir -p $TMP_DIR/usr/local/bin/
|
|
||||||
cp $BIN_DIR/kompose-linux-amd64 $TMP_DIR/usr/local/bin/kompose
|
|
||||||
|
|
||||||
echo "creating DEB package"
|
|
||||||
fpm \
|
|
||||||
--input-type dir --output-type deb \
|
|
||||||
--chdir $TMP_DIR \
|
|
||||||
--name kompose --version $PKG_VERSION \
|
|
||||||
--architecture amd64 \
|
|
||||||
--maintainer "Charlie Drage <cdrage@redhat.com>" \
|
|
||||||
--package $PKG_DIR
|
|
||||||
|
|
||||||
echo "creating RPM package"
|
|
||||||
fpm \
|
|
||||||
--input-type dir --output-type rpm \
|
|
||||||
--chdir $TMP_DIR \
|
|
||||||
--name kompose --version $PKG_VERSION \
|
|
||||||
--architecture x86_64 --rpm-os linux \
|
|
||||||
--maintainer "Charlie Drage <cdrage@redhat.com>" \
|
|
||||||
--package $PKG_DIR
|
|
||||||
}
|
|
||||||
|
|
||||||
create_tarballs() {
|
create_tarballs() {
|
||||||
# cd into the bin directory so we don't have '/bin' inside the tarball
|
# cd into the bin directory so we don't have '/bin' inside the tarball
|
||||||
cd bin
|
cd bin
|
||||||
@@ -180,7 +105,7 @@ git_commit() {
|
|||||||
git add .
|
git add .
|
||||||
git commit -m "$1 Release"
|
git commit -m "$1 Release"
|
||||||
git push origin $BRANCH
|
git push origin $BRANCH
|
||||||
hub pull-request -b $UPSTREAM_REPO/$CLI:master -h $ORIGIN_REPO/$CLI:$BRANCH
|
gh pr
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "PR opened against master to update version"
|
echo "PR opened against master to update version"
|
||||||
@@ -198,10 +123,6 @@ git_sync() {
|
|||||||
git rebase upstream/master
|
git rebase upstream/master
|
||||||
}
|
}
|
||||||
|
|
||||||
git_tag() {
|
|
||||||
git tag v$1
|
|
||||||
}
|
|
||||||
|
|
||||||
generate_install_guide() {
|
generate_install_guide() {
|
||||||
echo "
|
echo "
|
||||||
# Installation
|
# Installation
|
||||||
@@ -238,46 +159,17 @@ __Checksums:__
|
|||||||
echo "$HASH $NAME" >> bin/SHA256_SUM
|
echo "$HASH $NAME" >> bin/SHA256_SUM
|
||||||
done
|
done
|
||||||
|
|
||||||
# Append the file to the file
|
|
||||||
cat install_guide.txt >> changes.txt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
push() {
|
push() {
|
||||||
CHANGES=$(cat changes.txt)
|
|
||||||
# Release it!
|
|
||||||
|
|
||||||
echo "Creating GitHub tag"
|
echo "!!PLEASE READ!!
|
||||||
github-release release \
|
1. Say YES to GitHub generating the release notes
|
||||||
--user $UPSTREAM_REPO \
|
2. Append install_guide.txt to the TOP of the release notes when prompted
|
||||||
--repo $CLI \
|
3. Double check that the binaries have been UPLOADED!
|
||||||
--tag v$1 \
|
"
|
||||||
--name "v$1" \
|
|
||||||
--description "$CHANGES"
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo UPLOAD OK
|
|
||||||
else
|
|
||||||
echo UPLOAD FAIL
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Upload all the binaries and tarballs generated in bin/
|
gh release create v$1 bin/*
|
||||||
for f in bin/*
|
|
||||||
do
|
|
||||||
echo "Uploading file $f"
|
|
||||||
NAME=`echo $f | sed "s,bin/,,g"`
|
|
||||||
github-release upload \
|
|
||||||
--user $UPSTREAM_REPO \
|
|
||||||
--repo $CLI \
|
|
||||||
--tag v$1 \
|
|
||||||
--file $f \
|
|
||||||
--name $NAME
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo UPLOAD OK
|
|
||||||
else
|
|
||||||
echo UPLOAD FAIL
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "DONE"
|
echo "DONE"
|
||||||
echo "DOUBLE CHECK IT:"
|
echo "DOUBLE CHECK IT:"
|
||||||
@@ -287,7 +179,7 @@ push() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clean() {
|
clean() {
|
||||||
rm changes.txt install_guide.txt
|
rm install_guide.txt
|
||||||
rm -r bin/*
|
rm -r bin/*
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,11 +217,8 @@ main() {
|
|||||||
options=(
|
options=(
|
||||||
"Initial sync with upstream"
|
"Initial sync with upstream"
|
||||||
"Replace version number"
|
"Replace version number"
|
||||||
"Generate changelog"
|
|
||||||
"Generate GitHub changelog"
|
|
||||||
"Create PR"
|
"Create PR"
|
||||||
"Sync with upstream"
|
"Sync with upstream"
|
||||||
"Create tag"
|
|
||||||
"Build binaries"
|
"Build binaries"
|
||||||
"Build packages"
|
"Build packages"
|
||||||
"Create tarballs"
|
"Create tarballs"
|
||||||
@@ -347,27 +236,15 @@ main() {
|
|||||||
"Replace version number")
|
"Replace version number")
|
||||||
replaceversion $PREV_VERSION $VERSION
|
replaceversion $PREV_VERSION $VERSION
|
||||||
;;
|
;;
|
||||||
"Generate changelog")
|
|
||||||
changelog $VERSION
|
|
||||||
;;
|
|
||||||
"Generate GitHub changelog")
|
|
||||||
changelog_github $VERSION
|
|
||||||
;;
|
|
||||||
"Create PR")
|
"Create PR")
|
||||||
git_commit $VERSION
|
git_commit $VERSION
|
||||||
;;
|
;;
|
||||||
"Sync with upstream")
|
"Sync with upstream")
|
||||||
git_sync
|
git_sync
|
||||||
;;
|
;;
|
||||||
"Create tag")
|
|
||||||
git_tag $VERSION
|
|
||||||
;;
|
|
||||||
"Build binaries")
|
"Build binaries")
|
||||||
build_binaries
|
build_binaries
|
||||||
;;
|
;;
|
||||||
"Build packages")
|
|
||||||
build_packages $VERSION
|
|
||||||
;;
|
|
||||||
"Create tarballs")
|
"Create tarballs")
|
||||||
create_tarballs
|
create_tarballs
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in New Issue
Block a user