Skip to content

Commit 3b23516

Browse files
committed
Makefile,release,.gitignore: release in Docker
This allows us to standardize release instructions and should make it easier for end users to release in a standard way, regardless of the Go version or dependency versions running on their machine. Remove "download dependencies" step since we should be using the vendor directory for changes.
1 parent 55a192c commit 3b23516

4 files changed

Lines changed: 31 additions & 34 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ jobs:
1818
# staticcheck needs this for GOPATH
1919
- run: echo "::set-env name=GOPATH::$GITHUB_WORKSPACE"
2020
- run: echo "::set-env name=PATH::$GITHUB_WORKSPACE/bin:$PATH"
21-
- name: Download dependencies
22-
run: go get -t -v ./...
23-
working-directory: './src/github.com/github-release/github-release'
2421
- name: Run tests
2522
run: make test
2623
working-directory: './src/github.com/github-release/github-release'

.gitignore

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,7 @@
1-
github-release
2-
go-app
3-
bin/
4-
5-
# Compiled Object files, Static and Dynamic libs (Shared Objects)
6-
*.o
7-
*.a
8-
*.so
9-
10-
# Folders
11-
_obj
12-
_test
13-
14-
# Architecture specific extensions/prefixes
15-
*.[568vq]
16-
[568vq].out
17-
18-
*.cgo1.go
19-
*.cgo2.c
20-
_cgo_defun.c
21-
_cgo_gotypes.go
22-
_cgo_export.*
23-
24-
_testmain.go
1+
/github-release
2+
/go-app
253

264
*.exe
5+
6+
/bin
7+
/var/cache

Makefile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
SHELL=/bin/bash -o pipefail
2+
13
LAST_TAG := $(shell git describe --abbrev=0 --tags)
24

35
USER := github-release
@@ -21,7 +23,7 @@ all: $(EXECUTABLE)
2123

2224
# the executable used to perform the upload, dogfooding and all...
2325
bin/tmp/$(EXECUTABLE):
24-
go build -o "$@"
26+
go build -v -o "$@"
2527

2628
# arm
2729
bin/linux/arm/5/$(EXECUTABLE):
@@ -60,12 +62,17 @@ ifndef GITHUB_TOKEN
6062
@echo "Please set GITHUB_TOKEN in the environment to perform a release"
6163
exit 1
6264
endif
63-
$(MAKE) bin/tmp/$(EXECUTABLE) $(COMPRESSED_EXECUTABLE_TARGETS)
64-
git push && git push --tags
65-
git log --format=%B $(LAST_TAG) -1 | \
66-
bin/tmp/$(EXECUTABLE) release -u $(USER) -r $(EXECUTABLE) \
67-
-t $(LAST_TAG) -n $(LAST_TAG) -d - || true
68-
$(foreach FILE,$(COMPRESSED_EXECUTABLES),$(UPLOAD_CMD);)
65+
docker run --rm --volume $(PWD)/var/cache:/root/.cache/go-build \
66+
--env GITHUB_TOKEN=$(GITHUB_TOKEN) \
67+
--volume "$(PWD)":/go/src/github.com/github-release/github-release \
68+
--workdir /go/src/github.com/github-release/github-release \
69+
meterup/ubuntu-golang:latest \
70+
./release \
71+
"$(MAKE) bin/tmp/$(EXECUTABLE) $(COMPRESSED_EXECUTABLE_TARGETS) && \
72+
git log --format=%B $(LAST_TAG) -1 | \
73+
bin/tmp/$(EXECUTABLE) release -u $(USER) -r $(EXECUTABLE) \
74+
-t $(LAST_TAG) -n $(LAST_TAG) -d - || true && \
75+
$(foreach FILE,$(COMPRESSED_EXECUTABLES),$(UPLOAD_CMD);)"
6976

7077
# install and/or update all dependencies, run this from the project directory
7178
# go get -u ./...

release

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
main() {
6+
apt-get update && apt-get install zip
7+
git branch --set-upstream-to=origin/master release
8+
set -x
9+
exec /bin/bash -c "$@"
10+
}
11+
12+
main "$@"

0 commit comments

Comments
 (0)