-
Notifications
You must be signed in to change notification settings - Fork 63
/
build
executable file
·43 lines (32 loc) · 980 Bytes
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash -e
function repo_root() {
git rev-parse --show-toplevel
}
function project_version() {
# VERSION derived from CHANGELOG and automated release library
echo "$(<"$(repo_root)/VERSION")"
}
function project_semantic_version() {
local version
version="$(project_version)"
# Remove Jenkins build number from VERSION
echo "${version/-*/}"
}
CURRENT_DIR=$(pwd)
echo "Current dir: $CURRENT_DIR"
MOUNT_DIR="/summon"
GORELEASER_IMAGE="goreleaser/goreleaser:latest"
VERSION="$(project_semantic_version)"
docker pull "${GORELEASER_IMAGE}"
docker run --rm -t \
--env GITHUB_TOKEN \
--env GOTOOLCHAIN=auto \
--env VERSION="${VERSION}" \
--entrypoint "/sbin/tini" \
-v "$CURRENT_DIR:$MOUNT_DIR" \
-w "$MOUNT_DIR" \
"${GORELEASER_IMAGE}" \
-- sh -c "git config --global --add safe.directory /summon && \
/entrypoint.sh --clean $@ && \
rm ./dist/goreleaser/artifacts.json"
echo "Releases built. Archives can be found in dist/goreleaser"