-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTaskfile.yml
78 lines (75 loc) · 2.7 KB
/
Taskfile.yml
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# https://taskfile.dev
version: '3'
tasks:
#
# usage: env RELEASE_TAG=v0.1.0 summon task release
#
release:
desc: Build a release and upload to GitHub as draft. You need to transition
from draft to published in the web UI.
preconditions:
- sh: test -n "$RELEASE_TAG"
msg: "error: missing environment variable RELEASE_TAG"
- sh: test -z $(git status --porcelain)
msg: "error: git dirty"
- sh: test -z $(git status --branch --porcelain | grep ahead)
msg: "error: git local branch ahead"
cmds:
# - task: unit-test
# We create the (local) git tag now, after having ran the unit tests and
# before building the executables, so that we can embed this information
# in the binaries.
# To recover: delete local tag: git tag --delete tagname
- git tag -a {{.RELEASE_TAG}} -m ''
- task: release-linux
- task: release-darwin
# - task: system-test
- task: test
# We create the release as a draft (that is: not visible to the public).
# The act of "publishing" the release is left to a human from the web UI.
- >
github-release release
--tag {{.RELEASE_TAG}}
--draft
--description
"See the [CHANGELOG](https://github.com/$GITHUB_USER/$GITHUB_REPO/blob/{{.RELEASE_TAG}}/CHANGELOG.md)"
# Upload the artifacts.
- >
github-release upload
--tag {{.RELEASE_TAG}}
--name timeit-linux-amd64.zip
--file bin/linux/timeit-linux-amd64.zip
- >
github-release upload
--tag {{.RELEASE_TAG}}
--name timeit-darwin-amd64.zip
--file bin/darwin/timeit-darwin-amd64.zip
# We don't push the git tag. Instead, in the web UI, the act of
# transitioning the release from draft to published will create the
# corresponding tag in the remote repository. This is safer, because it
# reduces the situations when one might be tempted to delete a public tag
# due to a mistake in the release.
- cmd: |
echo "Draft release $RELEASE_TAG created successfully."
echo "Remember to publish it in the GitHub web UI https://github.com/$GITHUB_USER/$GITHUB_REPO/releases"
silent: true
env:
GITHUB_USER: marco-m
GITHUB_REPO: timeit
# GITHUB_TOKEN expected to be set securely via `summon` or equivalent
release-linux:
dir: bin/linux
cmds: &release-cmds
- go build -v -ldflags="{{.LDFLAGS}}" ../../cmd/timeit
- zip timeit-$GOOS-$GOARCH.zip timeit
env:
CGO_ENABLED: 0
GOOS: linux
GOARCH: amd64
release-darwin:
dir: bin/darwin
cmds: *release-cmds
env:
CGO_ENABLED: 0
GOOS: darwin
GOARCH: amd64