Skip to content

Commit

Permalink
Update to go1.16 and split releaser to separate builds on Linux, macO…
Browse files Browse the repository at this point in the history
…S, and Windows (#599)

* Update to go 1.16 and update dependencies

* Update linter and fix new linting issues

* Test against go.1.16

* Run mod tidy

* Start splitting the goreleaser flow to mac and everything else

* Remove the golang cross compile steps

* Update goreleaser scripts for separate build paths

* Remove some unneeded steps temporarily

* Split builds per platform

* Add missing docker, nfpms, and scoop steps

* Apply yaml formatter for consistency

* Move build files into a folder and make the release steps consistent

* Apply consistent formatting

* Add fetch depth to mac and windows
  • Loading branch information
tomelm committed Mar 11, 2021
1 parent e002d4e commit dbc4d53
Show file tree
Hide file tree
Showing 14 changed files with 329 additions and 277 deletions.
5 changes: 0 additions & 5 deletions .github/actions/releaser/Dockerfile

This file was deleted.

6 changes: 0 additions & 6 deletions .github/actions/releaser/action.yml

This file was deleted.

68 changes: 53 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,51 @@
name: publish_release
name: release

on:
push:
tags:
- 'v*'
- "v*"

jobs:
goreleaser:
build-mac:
runs-on: macos-latest
steps:
- name: Code checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: v0.157.0
args: release -f .goreleaser/mac.yml --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}

build-linux:
runs-on: ubuntu-latest
steps:
-
name: Code checkout
- name: Code checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Run goreleaser
uses: ./.github/actions/releaser
- name: Set up Go
uses: actions/setup-go@v2
with:
args: '--rm-dist'
go-version: 1.16
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: v0.157.0
args: release -f .goreleaser/linux.yml --rm-dist
env:
GORELEASER_GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
-
name: Upload to Bintray
- name: Upload to Bintray
run: |
scripts/publish-deb-to-bintray.sh
scripts/publish-rpm-to-bintray.sh
Expand All @@ -33,11 +54,28 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
-
name: Upload to VirusTotal

build-windows:
runs-on: windows-latest
steps:
- name: Code checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: v0.157.0
args: release -f .goreleaser/windows.yml --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
- name: Upload to VirusTotal
run: scripts/upload-zip-to-virustotal.sh
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
VIRUSTOTAL_API_KEY: ${{ secrets.VIRUSTOTAL_API_KEY }}

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.15.x]
go-version: [1.16.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
135 changes: 0 additions & 135 deletions .goreleaser.yml

This file was deleted.

65 changes: 65 additions & 0 deletions .goreleaser/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
env:
- GO111MODULE=on
before:
hooks:
- go mod download
- go generate ./...
project_name: stripe
builds:
- id: stripe-linux
ldflags:
- -s -w -X github.com/stripe/stripe-cli/pkg/version.Version={{.Version}}
binary: stripe
env:
- CGO_ENABLED=0
main: ./cmd/stripe/main.go
goos:
- linux
goarch:
- amd64
archives:
- replacements:
linux: linux
386: i386
amd64: x86_64
files:
- none*
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
checksum:
name_template: "{{ .ProjectName }}-linux-checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
nfpms:
- builds:
- stripe-linux
vendor: Stripe
homepage: https://stripe.com
maintainer: Stripe <support@stripe.com>
description: Stripe CLI utility
license: Apache 2.0
formats:
- deb
- rpm
dockers:
- goos: linux
goarch: amd64
binaries:
- stripe
builds:
- stripe-linux
image_templates:
- "stripe/stripe-cli:latest"
- "stripe/stripe-cli:{{ .Tag }}"
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=repository=https://github.com/stripe/stripe-cli"
- "--label=homepage=https://stripe.com"
60 changes: 60 additions & 0 deletions .goreleaser/mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
env:
- GO111MODULE=on
before:
hooks:
- go mod download
- go generate ./...
project_name: stripe
builds:
- id: stripe-darwin
ldflags:
- -s -w -X github.com/stripe/stripe-cli/pkg/version.Version={{.Version}}
binary: stripe
env:
- CGO_ENABLED=1
main: ./cmd/stripe/main.go
goos:
- darwin
goarch:
- amd64
archives:
- replacements:
darwin: mac-os
amd64: x86_64
files:
- none*
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
checksum:
name_template: "{{ .ProjectName }}-checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
brews:
- tap:
owner: stripe
name: homebrew-stripe-cli
commit_author:
name: stripe-ci
email: support@stripe.com
homepage: https://stripe.com
description: Stripe CLI utility
install: |
bin.install "stripe"
rm Dir["#{bin}/{stripe-completion.bash,stripe-completion.zsh}"]
system bin/"stripe", "completion", "--shell", "bash"
system bin/"stripe", "completion", "--shell", "zsh"
bash_completion.install "stripe-completion.bash"
zsh_completion.install "stripe-completion.zsh"
(zsh_completion/"_stripe").write <<~EOS
#compdef stripe
_stripe () {
local e
e=$(dirname ${funcsourcetrace[1]%:*})/stripe-completion.zsh
if [[ -f $e ]]; then source $e; fi
}
EOS
caveats: "❤ Thanks for installing the Stripe CLI! If this is your first time using the CLI, be sure to run `stripe login` first."

0 comments on commit dbc4d53

Please sign in to comment.