Skip to content

Commit

Permalink
docs(dev): update binaries and release w/ goreleaser changes
Browse files Browse the repository at this point in the history
- hadn't seen these docs before, so updating them to match all the `goreleaser` changes
  - no need to install various deps, just `goreleaser` with `go mod tidy`
  - no need to install and run `deploy.sh`, just `make snapshot` and `make release`

- update `make snapshot` to remove `--single-target` so that it will build all binaries as a dry-run
  - since it's no longer needed for the default target build, can make it output all binaries

- TODO: modify changelog / release notes / versioning to match Sylvain's current style
  - Didn't change some references to `VERSION` and `deployment.yml` as I will likely make those work with `goreleaser`

- also fix some typos:
  - "developper" -> "developer"
  - "dependancies" -> "dependencies"
  - "gitub" -> "github"
  - "repos" -> "repo"
  - "you" -> "your"
  - "priviledges" -> "privileges"
  - etc
  • Loading branch information
agilgur5 committed Aug 29, 2022
1 parent ae7431b commit 6d289d3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 110 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ clean:
rm -f docopts-* docopts README.tmp dist/*

snapshot: install_builddep
GOVERSION=$(GOVERSION) goreleaser build --rm-dist --snapshot --single-target -o docopts
GOVERSION=$(GOVERSION) goreleaser build --rm-dist --snapshot -o docopts

release: clean all test snapshot
GOVERSION=$(GOVERSION) goreleaser release
115 changes: 16 additions & 99 deletions docs/pre_built_binaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,152 +17,69 @@ Or we provide a command line helper if you cloned this repository, that will
simply download the good binary format from our repository and provide a `docopts` binary in
your current folder.


```
./get_docopts.sh
```

## Release binaries

This section is for developper. In order to release binaries you will need
This section is for developers. In order to release binaries you will need
some granted access to github API.

You will also need some more developper tools.

Most of the tools require a working [Go developper
environment](https://golang.org/doc/code.html#Organization). Which should not be too
complicated to setup.
You will also need some more developer tools.

All dependancies are installed in your Go workspace with:
All dependencies are installed with:

```
make install_builddep
```

Go for it:

### gox

We provide binaries cross-compiled from GNU/Linux using [gox](https://github.com/mitchellh/gox)

```
go get github.com/mitchellh/gox
```

### govvv

Get version information to be embedded in binary at compile time

```
go get github.com/ahmetb/govvv
```

### github release uploader
### `goreleaser`

We publish release using a command line tools and using github API [gothub](https://github.com/itchio/gothub)
[`goreleaser`](https://github.com/goreleaser/goreleaser) is used to cross-compile binaries for different platforms as well publish GitHub releases.

```
go get github.com/itchio/gothub
```
See the [`.goreleaser.yml`](../goreleaser.yml) for the configuration.

### github API token

You will need a valid gitub token for the target repository.
You will need a valid github token for the target repository.

https://help.github.com/articles/creating-an-access-token-for-command-line-use

The token needs to have `repos` auth priviledges.
The token needs to have `repo` auth privileges.

Then export it as a bash environment variable:

```
export GITHUB_TOKEN="you token here"
export GITHUB_TOKEN="your token here"
```

### git tag a new release
### `git tag` a new release

We use [semantic verion tags](https://semver.org/)

Our version is stored in VERSION file to be used by `govvv`.
Our version is stored in `VERSION` file.

```
echo "v0.6.3-alpha2" > VERSION
git tag -a "$(cat VERSION)" -m "golang 2019"
git push origin "$(cat VERSION)"
```

### yaml command-line tool

See: http://mikefarah.github.io/yq/

For extracting yaml data from `deployment.yml`

```
go get gopkg.in/mikefarah/yq.v2
```


## deploy / publish release

We provide a deploy script, which will take the last git tag, and a deployment
message written in a yaml file `deployment.yml`.

The script can be downloaded from https://github.com/opensource-expert/deploy.sh

### install `deploy.sh`

`deploy.sh` uses `docopts` for parsing our command line option. So you will need to build a first `docopts` and having
it installed in th PATH

build `docopts`:

```
cd path/to/docopt/docopts
make
```

clone and install `deploy.sh` (will be installed by default in `PREFIX=${HOME}/.local`

```
git clone https://github.com/opensource-expert/deploy.sh deploy_sh
cd deploy_sh
make
make install
```

if your `${HOME}/.local/bin` is not in your PATH

```
PATH=$PATH:${HOME}/.local/bin
```

test

```
deploy.sh -h
```

### deployment steps

In `docopts` project folder.

So you need to create the release text in `deployment.yml` before you run
`deploy.sh`.

See what will going on (dry-run):

```
deploy.sh deploy -n
```
You need to create the release text in `deployment.yml` first.

Deploy and replace existing binaries for this release.
Dry-run to create release files and binaries in the `dist/` dir:

```
deploy.sh deploy --replace
make snapshot
```

Only build binaries in `build/` dir:
Publish the binaries and release notes:

```
deploy.sh build
make release
```
13 changes: 3 additions & 10 deletions docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,10 @@ git tag
## 9. build the release
With [deploy.sh](https://github.com/opensource-expert/deploy.sh) installed in our PATH
Note: `deploy.sh` use `docopts` and `docopts.sh` in the PATH
The following will build all binary version from `deployment.yml`
```
deploy.sh build
make snapshot
```
## 10. push the tag on docopts
Expand All @@ -99,11 +96,7 @@ git push docopts $(cat ./VERSION)
## 11. deploy the release
load github env
```
. ./env
export GITHUB_USER=docopt
export GITHUB_REPO=docopts
deploy.sh deploy
export GITHUB_TOKEN="your token here"
make release
```

0 comments on commit 6d289d3

Please sign in to comment.