Skip to content

Commit

Permalink
Merge pull request #220 from ivanilves/ISSUE-212
Browse files Browse the repository at this point in the history
chore(CI): Re-structure of the release process
  • Loading branch information
vonrabbe authored Apr 5, 2020
2 parents 09505bc + d8a1665 commit b44e208
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
25 changes: 14 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ jobs:
name: Ensure commit messages conform semantic requirements
command: make semantic RANGE=$(git tag | egrep "^v[0-9]+\.[0-9]+\.[0-9]+" | tail -n1)..HEAD
- run:
name: Build release assets and binaries
command: |
make release
./dist/assets/lstags-linux/lstags --version
EXPECTED_RELEASE=$(cat dist/release/TAG)
ACTUAL_RELEASE=$(./dist/assets/lstags-linux/lstags --version | cut -d" " -f2)
if [ "${ACTUAL_RELEASE}" != "${EXPECTED_RELEASE}" ]; then
echo "Release versioning is inconsistent (expected: ${EXPECTED_RELEASE} / actual: ${ACTUAL_RELEASE})" >>/dev/stderr
exit 1
fi
- deploy:
name: Login to Docker (only for master)
command: |
if [ ${CIRCLE_BRANCH} == "master" ]; then
Expand All @@ -84,24 +96,15 @@ jobs:
else
echo '{}' > docker.json
fi
- run:
- deploy:
name: Login to GitHub (only for master)
command: |
if [ ${CIRCLE_BRANCH} == "master" ]; then
git remote set-url --push origin https://${GITHUB_TOKEN}@github.com/ivanilves/lstags.git
fi
- run:
- deploy:
name: Deploy GitHub release and DockerHub image (only for master)
command: |
make release
EXPECTED_RELEASE=$(cat dist/release/TAG)
ACTUAL_RELEASE=$(./dist/assets/lstags-linux/lstags --version | cut -d" " -f2)
if [ "${ACTUAL_RELEASE}" != "${EXPECTED_RELEASE}" ]; then
echo "Release versioning is inconsistent (expected: ${EXPECTED_RELEASE} / actual: ${ACTUAL_RELEASE})" >>/dev/stderr
exit 1
fi
if [ ${CIRCLE_BRANCH} == "master" ]; then
make docker-image DOCKER_TAG=release
make deploy
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,14 @@ fail-on-errors:
@echo "${ERRORS}" | grep . || echo "OK"
@test `echo "${ERRORS}" | grep . | wc -l` -eq 0

./dist/assets/lstags-linux/lstags: export GOOS:=linux
./dist/assets/lstags-linux/lstags:
mkdir -p dist/assets/lstags-linux; \
go build -mod=vendor -ldflags '-s -w' -a -tags netgo -installsuffix netgo -o dist/assets/lstags-linux/lstags

docker-image: DOCKER_REPO:=ivanilves/lstags
docker-image: DOCKER_TAG:=latest
docker-image: GOOS:=linux
docker-image: build
docker-image: ./dist/assets/lstags-linux/lstags
docker-image:
@docker image build --no-cache -t ${DOCKER_REPO}:${DOCKER_TAG} .

Expand Down

0 comments on commit b44e208

Please sign in to comment.