diff --git a/.circleci/config.yml b/.circleci/config.yml index f638e3a..c68dee5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a0dd528 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +go-minipypi +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..d60ebcd --- /dev/null +++ b/.goreleaser.yml @@ -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:' diff --git a/README.md b/README.md index 01cf0d6..ed9155f 100644 --- a/README.md +++ b/README.md @@ -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 + ``` diff --git a/main.go b/main.go index afd3b5e..0bbd533 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "flag" + "fmt" "io/ioutil" "log" "os" @@ -16,6 +17,12 @@ type Configs struct { S3configs S3configs } +var ( + version = "dev" + commit = "none" + date = "unknown" +) + func genConfig(filename string) { cfg := &Configs{ WebConfigs: WebServerConfigs{ @@ -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")