Skip to content

Commit

Permalink
use the GitHub cli to release a new version
Browse files Browse the repository at this point in the history
  • Loading branch information
keyki committed Nov 2, 2021
1 parent f2e4d73 commit 0ba8985
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,21 @@ BUILD_TIME=$(shell date +%FT%T)
LDFLAGS=-ldflags "-X github.com/hortonworks/salt-bootstrap/saltboot.Version=${VERSION} -X github.com/hortonworks/salt-bootstrap/saltboot.BuildTime=${BUILD_TIME}"
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./.git/*")


deps:
go get github.com/gliderlabs/glu
ifeq (, $(shell which gh))
ifeq ($(shell uname),Linux)
apt-get update
apt-get -y install software-properties-common
apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
apt-add-repository https://cli.github.com/packages
apt update
apt -y install gh
endif
ifeq ($(shell uname),Darwin)
brew install gh
endif
gh auth login
endif
go get -u github.com/golang/dep/cmd/dep

clean:
Expand Down Expand Up @@ -48,7 +60,7 @@ build-ppc64le:

release: build-docker
rm -rf release
glu release
VERSION=${VERSION} BINARY=${BINARY} ./release.sh

docker_env_up:
docker-compose -f docker/docker-compose.yml up -d
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@

SaltStack is a configuration management software which delivers fast & scalable event-driven infrastructure automated. But how you configure SaltStack itself if your cluster infrastructure created dynamically by automatized tools. That's where Salt Bootstrap comes in picture.
Salt Bootstrap is part of [Cloudbreak](https://github.com/sequenceiq/cloudbreak) project. It's responsibility to configure SaltStack master and minions cluster wide, manage service life-cycle on members of the cluster and distribute common states, formulas, templates generated by the orchestrator tool. Salt Bootstrap provides a secured interface to spin up SaltStack cluster instead of executing plain ssh commands on each members.

# Release
To release a new version please update the `VERSION` variable in the Makefile and call
```
make release
```
If you don't have the GitHub cli installed call
```
make deps
```
before the release. GitHub cli is used to create the release and upload the artifacts to GitHub.
24 changes: 24 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#! /bin/bash
set -x

rm -rf release
mkdir release

ARCH=$(uname -m)

declare -a Platforms=("Linux" "Darwin")
for platform in ${Platforms[@]}; do
if [ -d "./build/$platform" ]; then
echo "Compressing the ${platform} relevant binary ..."
tar -zcf "release/${BINARY}_${VERSION}_${platform}_${ARCH}.tgz" -C build/$platform $BINARY
fi
done

echo "Creating release v${VERSION} from branch $BRANCH ..."

output=$(gh release list | grep ${VERSION})
if [ -z "$output" ]; then
gh release create "v${VERSION}" "./release/${BINARY}_${VERSION}_Linux_${ARCH}.tgz" "./release/${BINARY}_${VERSION}_Darwin_${ARCH}.tgz" -t ${VERSION} -n ""
else
echo "The cli release ${VERSION} already exists on the github."
fi

0 comments on commit 0ba8985

Please sign in to comment.