Skip to content

Commit b6f0cc2

Browse files
author
Katrina Owen
authored
Merge pull request #886 from ekingery/master
Added GoReleaser config, updated docs, made archive naming adjustments
2 parents d95de6b + c19d34c commit b6f0cc2

File tree

6 files changed

+257
-139
lines changed

6 files changed

+257
-139
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
_obj
88
_test
99
vendor/
10+
dist/
1011

1112
# Architecture specific extensions/prefixes
1213
*.[568vq]

.goreleaser.yml

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
# You can find the GoReleaser documentation at http://goreleaser.com
2+
project_name: exercism
3+
4+
builds:
5+
- env:
6+
- CGO_ENABLED=0
7+
main: ./exercism/main.go
8+
goos:
9+
- darwin
10+
- linux
11+
- windows
12+
- freebsd
13+
- openbsd
14+
goarch:
15+
- amd64
16+
- 386
17+
- arm
18+
- ppc64
19+
goarm:
20+
- 5
21+
- 6
22+
ignore:
23+
- goos: openbsd
24+
goarch: arm
25+
- goos: freebsd
26+
goarch: arm
27+
28+
checksum:
29+
name_template: '{{ .ProjectName }}_checksums.txt'
30+
31+
changelog:
32+
sort: asc
33+
filters:
34+
exclude:
35+
- '^docs:'
36+
- '^test:'
37+
38+
archives:
39+
- name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
40+
replacements:
41+
amd64: x86_64
42+
386: i386
43+
format_overrides:
44+
- goos: windows
45+
format: zip
46+
files:
47+
- shell/**/*
48+
- LICENSE
49+
- README.md
50+
51+
signs:
52+
- artifacts: checksum
53+
54+
release:
55+
# Repo in which the release will be created.
56+
# Default is extracted from the origin remote URL.
57+
github:
58+
name: cli
59+
60+
# If set to true, will not auto-publish the release.
61+
# Default is false.
62+
draft: true
63+
64+
# If set to auto, will mark the release as not ready for production
65+
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
66+
# If set to true, will mark the release as not ready for production.
67+
# Default is false.
68+
prerelease: auto
69+
70+
# You can change the name of the GitHub release.
71+
# Default is `{{.Tag}}`
72+
name_template: "{{.ProjectName}}-v{{.Version}} {{.Env.USER}}"
73+
74+
snapcrafts:
75+
-
76+
name: exercism-cli
77+
license: MIT
78+
# Whether to publish the snap to the snapcraft store.
79+
# Remember you need to `snapcraft login` first.
80+
# Defaults to false.
81+
# publish: true
82+
summary: Command-line client for https://exercism.io
83+
# https://snapcraft.io/docs/reference/confinement
84+
confinement: strict
85+
# A snap of type base to be used as the execution environment for this snap.
86+
base: core18
87+
# https://snapcraft.io/docs/reference/channels
88+
grade: stable
89+
description: Exercism is an online platform designed to help you improve your coding skills through practice and mentorship. Exercism provides you with thousands of exercises spread across numerous language tracks. Each one is a fun and interesting challenge designed to teach you a little more about the features of a language.
90+
name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
91+
replacements:
92+
amd64: x86_64
93+
386: i386
94+
apps:
95+
exercism:
96+
plugs: ["home", "network", "removable-media"]
97+
98+
99+
# [TODO]
100+
# brews:
101+
# -
102+
# # Name template of the recipe
103+
# # Default to project name
104+
# name: myproject
105+
#
106+
# # IDs of the archives to use.
107+
# # Defaults to all.
108+
# ids:
109+
# - foo
110+
# - bar
111+
#
112+
#
113+
# # NOTE: make sure the url_template, the token and given repo (github or gitlab) owner and name are from the
114+
# # same kind. We will probably unify this in the next major version like it is done with scoop.
115+
#
116+
# # Github repository to push the tap to.
117+
# github:
118+
# owner: github-user
119+
# name: homebrew-tap
120+
#
121+
# # OR Gitlab
122+
# # gitlab:
123+
# # owner: gitlab-user
124+
# # name: homebrew-tap
125+
#
126+
# # Template for the url which is determined by the given Token (github or gitlab)
127+
# # Default for github is "https://github.com/<repo_owner>/<repo_name>/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
128+
# # Default for gitlab is "https://gitlab.com/<repo_owner>/<repo_name>/uploads/{{ .ArtifactUploadHash }}/{{ .ArtifactName }}"
129+
# url_template: "http://github.mycompany.com/foo/bar/releases/{{ .Tag }}/{{ .ArtifactName }}"
130+
#
131+
# # Allows you to set a custom download strategy.
132+
# # Default is empty.
133+
# download_strategy: GitHubPrivateRepositoryReleaseDownloadStrategy
134+
#
135+
# # Allows you to add a custom require_relative at the top of the formula template
136+
# # Default is empty
137+
# custom_require: custom_download_strategy
138+
#
139+
# # Git author used to commit to the repository.
140+
# # Defaults are shown.
141+
# commit_author:
142+
# name: goreleaserbot
143+
144+
#
145+
# # Folder inside the repository to put the formula.
146+
# # Default is the root folder.
147+
# folder: Formula
148+
#
149+
# # Caveats for the user of your binary.
150+
# # Default is empty.
151+
# caveats: "How to use this binary"
152+
#
153+
# # Your app's homepage.
154+
# # Default is empty.
155+
# homepage: "https://example.com/"
156+
#
157+
# # Your app's description.
158+
# # Default is empty.
159+
# description: "Software to create fast and easy drum rolls."
160+
#
161+
# # Setting this will prevent goreleaser to actually try to commit the updated
162+
# # formula - instead, the formula file will be stored on the dist folder only,
163+
# # leaving the responsibility of publishing it to the user.
164+
# # If set to auto, the release will not be uploaded to the homebrew tap
165+
# # in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1
166+
# # Default is false.
167+
# skip_upload: true
168+
#
169+
# # Custom block for brew.
170+
# # Can be used to specify alternate downloads for devel or head releases.
171+
# # Default is empty.
172+
# custom_block: |
173+
# head "https://github.com/some/package.git"
174+
# ...
175+
#
176+
# # Packages your package depends on.
177+
# dependencies:
178+
# - git
179+
# - zsh
180+
#
181+
# # Packages that conflict with your package.
182+
# conflicts:
183+
# - svn
184+
# - bash
185+
#
186+
# # Specify for packages that run as a service.
187+
# # Default is empty.
188+
# plist: |
189+
# <?xml version="1.0" encoding="UTF-8"?>
190+
# ...
191+
#
192+
# # So you can `brew test` your formula.
193+
# # Default is empty.
194+
# test: |
195+
# system "#{bin}/program --version"
196+
# ...
197+
#
198+
# # Custom install script for brew.
199+
# # Default is 'bin.install "program"'.
200+
# install: |
201+
# bin.install "program"
202+
# ...
203+
#

CONTRIBUTING.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,5 @@ On Windows:
4949
- `go build -o testercism.exe exercism\main.go`
5050
- `testercism.exe —h`
5151

52-
### Building for All Platforms
53-
54-
In order to cross-compile for all platforms, run `bin/build-all`. The binaries
55-
will be built into the `release` directory.
56-
57-
[fork]: https://github.com/exercism/cli/fork
52+
### Releasing a new CLI version
53+
Consult the [release documentation](https://github.com/exercism/cli/master/RELEASE.md).

RELEASE.md

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,57 @@
11
# Cutting a CLI Release
22

3-
## Bootstrap Cross-Compilation for Go
4-
5-
**This only has to be done once.**
6-
7-
Change directory to the go source. Then run the bootstrap command for
8-
each operating system and architecture.
9-
10-
```plain
11-
$ cd `which go`/../../src
12-
$ sudo GCO_ENABLED=0 GOOS=windows GOARCH=386 ./make.bash --no-clean
13-
$ sudo GCO_ENABLED=0 GOOS=darwin GOARCH=386 ./make.bash --no-clean
14-
$ sudo GCO_ENABLED=0 GOOS=linux GOARCH=386 ./make.bash --no-clean
15-
$ sudo GCO_ENABLED=0 GOOS=windows GOARCH=amd64 ./make.bash --no-clean
16-
$ sudo GCO_ENABLED=0 GOOS=darwin GOARCH=amd64 ./make.bash --no-clean
17-
$ sudo GCO_ENABLED=0 GOOS=linux GOARCH=amd64 ./make.bash --no-clean
18-
$ sudo GCO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 ./make.bash --no-clean
19-
$ sudo GCO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 ./make.bash --no-clean
3+
The Exercism CLI uses [GoReleaser](https://goreleaser.com) to automate the
4+
release process.
5+
6+
## Requirements
7+
8+
1. [Install GoReleaser](https://goreleaser.com/install/)
9+
1. [Install snapcraft](https://snapcraft.io/docs/snapcraft-overview)
10+
1. [Setup GitHub token](https://goreleaser.com/environment/#github-token)
11+
1. Have a gpg key installed on your machine - it is [used for signing the artifacts](https://goreleaser.com/sign/)
12+
13+
## Cut a release
14+
15+
```bash
16+
17+
# Test run
18+
goreleaser --skip-publish --snapshot --rm-dist
19+
20+
# Commit any changes, then create a new tag and push it
21+
git tag -a v3.0.16 -m "Trying out GoReleaser"
22+
git push origin v3.0.16
23+
24+
# Build and release
25+
goreleaser --rm-dist
26+
27+
# Remember to update cmd/version.go in the code
28+
# (until we use: https://goreleaser.com/environment/#using-the-main-version)
29+
30+
# You must be logged into snapcraft to publish a new snap
31+
snapcraft login
32+
33+
# Push to snapcraft
34+
for f in `ls dist/*.snap`; do snapcraft push --release=stable $f; done
35+
36+
# [TODO] Push to homebrew
37+
38+
# Run [exercism-cp-archive-hack.sh](https://gist.github.com/ekingery/961650fca4e2233098c8320f32736836) which takes the new archive files and renames them to match the old naming scheme for backward compatibility.
2039
```
2140

22-
## Update the Changelog
41+
Lastly, head to [the release page](https://github.com/exercism/cli/releases) to test and publish the draft. Until mid to late 2020, we will need to manually upload the backward-compatible archive files generated in `/tmp/exercism_tmp_upload` by the shell script referenced above.
42+
43+
44+
## Confirm / Update the Changelog
45+
46+
GoReleaser supports [auto generation of changelog](https://goreleaser.com/customization/#customize-the-changelog) that we will want to customize to meet our standards (not including refactors, test updates, etc). We should also consider [the release notes](https://goreleaser.com/customization/#custom-release-notes).
2347

2448
Make sure all the recent changes are reflected in the "next release" section
2549
of the Changelog. Make this a separate commit from bumping the version.
2650

2751
You can view changes using the /compare/ view:
2852
https://github.com/exercism/cli/compare/$PREVIOUS_RELEASE...master
2953

54+
3055
## Bump the version
3156

3257
Edit the `Version` constant in `cmd/version.go`, and edit the Changelog.
@@ -38,27 +63,16 @@ The "next release" section should contain only "Your contribution here".
3863

3964
_Note: It's useful to add the version to the commit message when you bump it: e.g. `Bump version to v2.3.4`._
4065

41-
## Generate the Binaries
42-
43-
```plain
44-
$ rm release/*
45-
$ CGO_ENABLED=0 bin/build-all
46-
```
66+
In the future we will probably want to replace the hardcoded `Version` constant with [main.version](https://goreleaser.com/environment/#using-the-main-version). Here is a [stack overflow post on injecting to cmd/version.go](https://stackoverflow.com/a/47510909).
4767

4868
## Cut Release on GitHub
4969

5070
Go to [the exercism/cli "new release" page](https://github.com/exercism/cli/releases/new).
5171

52-
Describe the release, select a specific commit to target, name the version `v{VERSION}`, where
53-
VERSION matches the value of the `Version` constant.
54-
55-
Upload all the binaries from `release/*`.
56-
57-
Paste the release text and describe the new changes.
72+
A draft will have been auto-generated by GoReleaser. Describe the release, select a specific commit to target, paste the release text and describe the new changes.
5873

5974
```
6075
To install, follow the interactive installation instructions at https://exercism.io/cli-walkthrough
61-
6276
---
6377
6478
[describe changes in this release]

0 commit comments

Comments
 (0)