Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use goreleaser #18

Merged
merged 4 commits into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
name: Run unit tests
command: gotestsum --junitfile ${TEST_RESULTS}/go-test-report.xml

- run: go build
- run: go build -ldflags "-X main.date=`date -u +%Y-%m-%dT%H:%M:%SZ` -X main.commit=${CIRCLE_SHA1}"

- run:
name: Create build artifact
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
go-minipypi
dist/
36 changes: 36 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
# you may remove this if you don't use vgo
- go mod download
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- darwin
- linux
- freebsd
- windows
goarch:
- amd64
archive:
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
format: binary
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,28 @@ Installation
Notes:
------
It requires a config file, see `config.yml`. Drop the `credentialsfile` parameter to use the [default AWS credentials chain](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials).

Release
-------

go-minipypi uses [goreleaser](https://github.com/goreleaser/goreleaser) locally for releases.

1. Install [goreleaser](https://goreleaser.com/install/)

2. Ensure you're on a clean master, and tag the current commit for release -

```sh
git tag -a "v0.4.0"
```

3. Do a dry-run of the release if necessary and check the artifacts in `dist/` -

```sh
goreleaser --skip-publish
```

4. Using your GitHub token, complete the release -

```sh
GITHUB_TOKEN=your_github_token_with_release_privileges goreleaser
```
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
Expand All @@ -16,6 +17,12 @@ type Configs struct {
S3configs S3configs
}

var (
version = "dev"
commit = "none"
date = "unknown"
)

func genConfig(filename string) {
cfg := &Configs{
WebConfigs: WebServerConfigs{
Expand All @@ -38,6 +45,8 @@ func genConfig(filename string) {
}

func main() {
fmt.Printf("go-minipypi - %v, commit %v, built at %v\n", version, commit, date)

cfg := Configs{}

var configFile = flag.String("config", "config.yml", "config file")
Expand Down