Skip to content

Commit

Permalink
Use Goreleaser to publish releases (#68)
Browse files Browse the repository at this point in the history
* Use Goreleaser to publish releases

* Fix vendoring
  • Loading branch information
ofalvai authored Sep 19, 2022
1 parent 19dd850 commit 240f331
Show file tree
Hide file tree
Showing 40 changed files with 211 additions and 995 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
bitrise-add-new-project
docker_linux_interactive/bitrise-add-new-project

/.idea/
/.idea/

dist/
72 changes: 72 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
- arm64
overrides:
# Enable CGO for darwin builds (codesigndoc is a dependency for darwin builds)
- goos: darwin
goarch: arm64
env:
- CGO_ENABLED=1
- goos: darwin
goarch: amd64
goamd64: v1
env:
- CGO_ENABLED=1
ignore:
# We don't want to publish a linux-arm64 binary
- goos: linux
goarch: arm64

archives:
# GitHub release should contain the raw binaries (no zip or tar.gz)
- format: binary
# Name format should match the curl install script
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
replacements:
darwin: Darwin
linux: Linux
amd64: x86_64

release:
github:
owner: bitrise-io
name: bitrise-add-new-project
draft: true
mode: replace
footer: |
### Install or upgrade
To install this version, run the following command (in a bash shell):
```bash
curl -fL https://github.com/bitrise-io/{{ .ProjectName }}/releases/download/{{ .Tag }}/{{ .ProjectName }}-"$(uname -s)"-"$(uname -m)" > /usr/local/bin/{{ .ProjectName }}
```
ℹ️ M1 machine: Please note by default `/usr/local/bin` does not exist on M1 machines and isn't encouraged by the community over `/opt/bin`. Use a custom folder path or use your own `bin` folder path. i.e `/opt/bin`
Then:
```
chmod +x /usr/local/bin/{{ .ProjectName }}
```
That's all, you're ready to call `{{ .ProjectName }}`!
checksum:
name_template: 'checksums.txt'
snapshot:
# Run `goreleaser release --snapshot` locally to create binaries without publishing and checks
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
74 changes: 49 additions & 25 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,60 @@ default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
workflows:
test:
steps:
- go-list:
- golint:
- errcheck:
- go-test:
- go-list: { }
- golint: { }
- errcheck: { }
- go-test: { }

test-linux-interactive:
steps:
- script:
inputs:
- content: |-
#!/bin/env bash
env GOOS=linux go build -v github.com/bitrise-io/bitrise-add-new-project
cp bitrise-add-new-project ./docker_linux_interactive
cd docker_linux_interactive
docker build --tag bitrise-add-new-project-test-interactive .
docker run --rm -ti bitrise-add-new-project-test-interactive
- script:
inputs:
- content: |-
#!/bin/env bash
env GOOS=linux go build -v github.com/bitrise-io/bitrise-add-new-project
cp bitrise-add-new-project ./docker_linux_interactive
cd docker_linux_interactive
docker build --tag bitrise-add-new-project-test-interactive .
docker run --rm -ti bitrise-add-new-project-test-interactive
test-linux:
steps:
- script:
inputs:
- content: |-
#!/bin/env bash
set -ex
docker build --tag bitrise-add-new-project-test docker_ci_linux/
docker run --rm bitrise-add-new-project-test
- script:
inputs:
- content: |-
#!/bin/env bash
set -ex
docker build --tag bitrise-add-new-project-test docker_ci_linux/
docker run --rm bitrise-add-new-project-test
create-release:
description: Creates Linux and Darwin binaries, then publishes a GitHub release
envs:
- GITHUB_TOKEN: $GIT_BOT_USER_ACCESS_TOKEN # Goreleaser expects this env var
steps:
- script:
title: Goreleaser (create binaries + publish to GH)
deps:
brew:
- name: goreleaser
inputs:
- content: |
#!/usr/bin/env bash
set -ex
goreleaser release
maintenance:
test-binary-build:
description: Tests the release build process by creating a snapshot release (without publishing)
steps:
- go-test:
inputs:
- packages: "./maintenance"
- script:
title: Goreleaser (create snapshot binaries)
deps:
brew:
- name: goreleaser
inputs:
- content: |
#!/usr/bin/env bash
set -ex
goreleaser release --snapshot --rm-dist
50 changes: 42 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,26 +1,60 @@
module github.com/bitrise-io/bitrise-add-new-project

go 1.16
go 1.18

require (
github.com/Microsoft/go-winio v0.5.0 // indirect
github.com/bitrise-io/bitrise v0.0.0-20210623145422-513e39485248
github.com/bitrise-io/bitrise-init v0.0.0-20220302151827-6df2455ae686
github.com/bitrise-io/codesigndoc v0.0.0-20220228120027-889a26b5d5c5
github.com/bitrise-io/envman v0.0.0-20210630102032-df85af51bd1a
github.com/bitrise-io/go-utils v1.0.1
github.com/bitrise-io/go-xcode v1.0.3
github.com/manifoldco/promptui v0.8.0
github.com/spf13/cobra v1.2.1
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e
gopkg.in/src-d/go-git.v4 v4.13.1
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/Microsoft/go-winio v0.5.0 // indirect
github.com/beevik/etree v1.1.0 // indirect
github.com/bitrise-io/go-plist v0.0.0-20210301100253-4b1a112ccd10 // indirect
github.com/bitrise-io/go-steputils v1.0.1 // indirect
github.com/bitrise-io/goinp v0.0.0-20210504152833-8559b0680ab1 // indirect
github.com/bitrise-io/gows v0.0.0-20210505125306-dd92ff463938 // indirect
github.com/bitrise-io/pkcs12 v0.0.0-20211108084543-e52728e011c8 // indirect
github.com/bitrise-io/stepman v0.0.0-20210517135458-203f7a48d37a // indirect
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.0 // indirect
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/juju/ansiterm v0.0.0-20210706145210-9283cdf370b5 // indirect
github.com/kevinburke/ssh_config v1.1.0 // indirect
github.com/lunixbochs/vtclean v1.0.0 // indirect
github.com/manifoldco/promptui v0.8.0
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/spf13/cobra v1.2.1
github.com/stretchr/testify v1.7.0
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/src-d/gcfg v1.4.0 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e
gopkg.in/src-d/go-git.v4 v4.13.1
gopkg.in/yaml.v2 v2.4.0
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
howett.net/plist v1.0.0 // indirect
)
9 changes: 0 additions & 9 deletions vendor/github.com/Microsoft/go-winio/go.mod

This file was deleted.

14 changes: 0 additions & 14 deletions vendor/github.com/Microsoft/go-winio/go.sum

This file was deleted.

10 changes: 0 additions & 10 deletions vendor/github.com/Sirupsen/logrus/go.mod

This file was deleted.

8 changes: 0 additions & 8 deletions vendor/github.com/Sirupsen/logrus/go.sum

This file was deleted.

9 changes: 0 additions & 9 deletions vendor/github.com/bitrise-io/go-plist/go.mod

This file was deleted.

11 changes: 0 additions & 11 deletions vendor/github.com/bitrise-io/go-plist/go.sum

This file was deleted.

3 changes: 0 additions & 3 deletions vendor/github.com/hashicorp/go-cleanhttp/go.mod

This file was deleted.

8 changes: 0 additions & 8 deletions vendor/github.com/hashicorp/go-retryablehttp/go.mod

This file was deleted.

10 changes: 0 additions & 10 deletions vendor/github.com/hashicorp/go-retryablehttp/go.sum

This file was deleted.

1 change: 0 additions & 1 deletion vendor/github.com/hashicorp/go-version/go.mod

This file was deleted.

1 change: 0 additions & 1 deletion vendor/github.com/lunixbochs/vtclean/go.mod

This file was deleted.

16 changes: 0 additions & 16 deletions vendor/github.com/manifoldco/promptui/go.mod

This file was deleted.

23 changes: 0 additions & 23 deletions vendor/github.com/manifoldco/promptui/go.sum

This file was deleted.

8 changes: 0 additions & 8 deletions vendor/github.com/mattn/go-colorable/go.mod

This file was deleted.

5 changes: 0 additions & 5 deletions vendor/github.com/mattn/go-colorable/go.sum

This file was deleted.

5 changes: 0 additions & 5 deletions vendor/github.com/mattn/go-isatty/go.mod

This file was deleted.

2 changes: 0 additions & 2 deletions vendor/github.com/mattn/go-isatty/go.sum

This file was deleted.

1 change: 0 additions & 1 deletion vendor/github.com/mitchellh/go-homedir/go.mod

This file was deleted.

Loading

0 comments on commit 240f331

Please sign in to comment.