Skip to content

Commit 5b92fa1

Browse files
committed
Build release with go install
Also, build releases in parallel
1 parent 9807d04 commit 5b92fa1

File tree

2 files changed

+68
-31
lines changed

2 files changed

+68
-31
lines changed

.circleci/rolling-shutter.yml

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,68 @@ jobs:
8181
paths:
8282
- "~/.cache/go-build"
8383

84+
build-release:
85+
parameters:
86+
go-os-arch:
87+
type: string
88+
executor: go
89+
working_directory: ~/
90+
steps:
91+
- run:
92+
name: Configure environment for private repository
93+
command: |
94+
mkdir ~/.ssh; chmod 700 ~/.ssh
95+
echo >>~/.ssh/known_hosts github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
96+
git config --global url."[email protected]:shutter-network/rolling-shutter".insteadOf https://github.com/shutter-network/rolling-shutter
97+
echo >>${BASH_ENV} export GOPRIVATE=github.com/shutter-network/rolling-shutter/rolling-shutter
98+
- run:
99+
name: Configure environment
100+
command: |
101+
version=$(echo ${CIRCLE_TAG} | sed -e s#^rolling-shutter/##)
102+
test -z ${version} && version=${CIRCLE_SHA1}
103+
echo >>${BASH_ENV} export VERSION="${version}"
104+
105+
echo >>${BASH_ENV} osarch=<< parameters.go-os-arch >>
106+
# set GOOS, GOARCH from osarch:
107+
echo SUZTPSctJyByZWFkIC1yIEdPT1MgR09BUkNIIDw8PCAke29zYXJjaH0K |base64 --decode >>${BASH_ENV}
108+
echo >>${BASH_ENV} export GOOS GOARCH
109+
- run:
110+
name: Go install
111+
command: |
112+
go install github.com/shutter-network/rolling-shutter/rolling-shutter@${CIRCLE_SHA1}
113+
- run:
114+
name: Copy binary
115+
command: |
116+
dst=${HOME}/release-bin/rolling-shutter-$GOOS-$GOARCH-$VERSION
117+
mkdir ${HOME}/release-bin
118+
if test -e ${HOME}/go/bin/rolling-shutter; then
119+
mv ${HOME}/go/bin/rolling-shutter ${dst}
120+
else
121+
mv ${HOME}/go/bin/${GOOS}_${GOARCH}/rolling-shutter ${dst}
122+
fi
123+
du -h ${dst}
124+
- persist_to_workspace:
125+
root: "~"
126+
paths:
127+
- "release-bin/"
128+
84129
publish-release:
85130
executor: go
86-
working_directory: ~/src/rolling-shutter
131+
working_directory: ~/
87132
steps:
88-
- checkout:
89-
path: ~/src
133+
- attach_workspace:
134+
at: ~/
90135
- run:
91136
name: Configure environment
92137
command: |
93138
version=$(echo ${CIRCLE_TAG} | sed -e s#^rolling-shutter/##)
94139
echo >>${BASH_ENV} export VERSION="${version}"
95-
echo >>${BASH_ENV} export BIN=/tmp/release-bin
96-
- run: ./build-release
97140
- run: go install github.com/tcnksm/[email protected]
98141
- run:
99142
name: Upload binaries
100143
command: |
101-
ghr ${CIRCLE_TAG} ${BIN}
144+
du -hc release-bin/*
145+
ghr ${CIRCLE_TAG} release-bin
102146
103147
rs-lint:
104148
executor: go
@@ -140,9 +184,27 @@ workflows:
140184
filters:
141185
tags:
142186
only: /.*/
187+
- build-release:
188+
matrix:
189+
parameters:
190+
go-os-arch:
191+
[
192+
"linux-amd64",
193+
"linux-arm64",
194+
"freebsd-amd64",
195+
"openbsd-amd64",
196+
"darwin-amd64",
197+
"darwin-arm64",
198+
]
199+
filters:
200+
branches:
201+
ignore: /.*/
202+
tags:
203+
only: /^rolling-shutter\/v\d+\.\d+\.\d+$/
143204
- publish-release:
144205
requires:
145206
- rs-build
207+
- build-release
146208
context:
147209
- upload-release
148210
filters:

rolling-shutter/build-release

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)