Skip to content

Commit d8a1665

Browse files
committed
chore(CI): Re-structure of the release process
1 parent 09505bc commit d8a1665

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

.circleci/config.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ jobs:
7575
name: Ensure commit messages conform semantic requirements
7676
command: make semantic RANGE=$(git tag | egrep "^v[0-9]+\.[0-9]+\.[0-9]+" | tail -n1)..HEAD
7777
- run:
78+
name: Build release assets and binaries
79+
command: |
80+
make release
81+
82+
./dist/assets/lstags-linux/lstags --version
83+
EXPECTED_RELEASE=$(cat dist/release/TAG)
84+
ACTUAL_RELEASE=$(./dist/assets/lstags-linux/lstags --version | cut -d" " -f2)
85+
if [ "${ACTUAL_RELEASE}" != "${EXPECTED_RELEASE}" ]; then
86+
echo "Release versioning is inconsistent (expected: ${EXPECTED_RELEASE} / actual: ${ACTUAL_RELEASE})" >>/dev/stderr
87+
exit 1
88+
fi
89+
- deploy:
7890
name: Login to Docker (only for master)
7991
command: |
8092
if [ ${CIRCLE_BRANCH} == "master" ]; then
@@ -84,24 +96,15 @@ jobs:
8496
else
8597
echo '{}' > docker.json
8698
fi
87-
- run:
99+
- deploy:
88100
name: Login to GitHub (only for master)
89101
command: |
90102
if [ ${CIRCLE_BRANCH} == "master" ]; then
91103
git remote set-url --push origin https://${GITHUB_TOKEN}@github.com/ivanilves/lstags.git
92104
fi
93-
- run:
105+
- deploy:
94106
name: Deploy GitHub release and DockerHub image (only for master)
95107
command: |
96-
make release
97-
98-
EXPECTED_RELEASE=$(cat dist/release/TAG)
99-
ACTUAL_RELEASE=$(./dist/assets/lstags-linux/lstags --version | cut -d" " -f2)
100-
if [ "${ACTUAL_RELEASE}" != "${EXPECTED_RELEASE}" ]; then
101-
echo "Release versioning is inconsistent (expected: ${EXPECTED_RELEASE} / actual: ${ACTUAL_RELEASE})" >>/dev/stderr
102-
exit 1
103-
fi
104-
105108
if [ ${CIRCLE_BRANCH} == "master" ]; then
106109
make docker-image DOCKER_TAG=release
107110
make deploy

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,14 @@ fail-on-errors:
111111
@echo "${ERRORS}" | grep . || echo "OK"
112112
@test `echo "${ERRORS}" | grep . | wc -l` -eq 0
113113

114+
./dist/assets/lstags-linux/lstags: export GOOS:=linux
115+
./dist/assets/lstags-linux/lstags:
116+
mkdir -p dist/assets/lstags-linux; \
117+
go build -mod=vendor -ldflags '-s -w' -a -tags netgo -installsuffix netgo -o dist/assets/lstags-linux/lstags
118+
114119
docker-image: DOCKER_REPO:=ivanilves/lstags
115120
docker-image: DOCKER_TAG:=latest
116-
docker-image: GOOS:=linux
117-
docker-image: build
121+
docker-image: ./dist/assets/lstags-linux/lstags
118122
docker-image:
119123
@docker image build --no-cache -t ${DOCKER_REPO}:${DOCKER_TAG} .
120124

0 commit comments

Comments
 (0)