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

feat(goreleaser): use github actions to make release via goreleaser #752

Merged
merged 2 commits into from
Aug 1, 2022
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
35 changes: 13 additions & 22 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
name: Publish
name: Test and Release Go CLI

on:
push:

jobs:
publish:
build:
name: GoReleaser build
runs-on: ubuntu-latest
env:
GOX_ARCHITECTURES: amd64 386
steps:
# Currently there is no possibility to get a tag name. Hence we filter the GITHUB_REF variable which contains something like "refs/tags/v2.0.0" if the tag is "v2.0.0". The value can be used with "steps.tag_name.outputs.TAG_NAME"
- name: Get tag name
if: startsWith(github.ref, 'refs/tags/')
id: tag_name
run: |
echo "::set-output name=TAG_NAME::${GITHUB_REF#refs/tags/}"
echo "$TAG_NAME"

- name: Checkout the code
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0 # See: https://goreleaser.com/ci/actions/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noice 👍🏾


- name: Setup Go environment
uses: actions/setup-go@v3
Expand All @@ -30,14 +24,11 @@ jobs:
- name: Execute the tests
run: go test -race ./...

- name: Build the binaries
if: startsWith(github.ref, 'refs/tags/')
run: |
go install github.com/mitchellh/gox@latest
./dists/make-release.sh -v ${{ steps.tag_name.outputs.TAG_NAME }}

- name: Release the new version
- name: Run GoReleaser
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
uses: goreleaser/goreleaser-action@v3
with:
files: ./bin/${{ steps.tag_name.outputs.TAG_NAME }}/*.{zip,tar.gz}
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 changes: 40 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
before:
hooks:
- go mod tidy
builds:
-
id: scalingo
binary: scalingo
main: ./scalingo
goos:
- linux
- windows
- darwin
- freebsd
- openbsd
goarch:
- amd64
- arm64
- 386
ignore:
- goos: darwin
goarch: 386

# Custom ldflags templates.
# https://goreleaser.com/customization/templates/
ldflags:
-X main.buildstamp={{.Date}}
-X main.githash={{.FullCommit}}

archives:
-
name_template: 'scalingo_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
wrap_in_directory: true
checksum:
name_template: 'checksums.txt'
changelog:
use: github
filters:
exclude:
- '^docs:'
- '^test:'
12 changes: 0 additions & 12 deletions .goxc.json

This file was deleted.

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### To be Released

* feat(goreleaser): use goreleaser to make releases using github action [#752](https://github.com/Scalingo/cli/issues/752)
* feat(make-release): use gox [#747](https://github.com/Scalingo/cli/pull/747)
* fix(install.sh): better error message if fails to get the version [#748](https://github.com/Scalingo/cli/pull/748)
* feat(logs): possibility to get the addon logs by using its type (e.g. Redis) [#745](https://github.com/Scalingo/cli/pull/745)
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ git push --set-upstream origin v1.23.0
Bump new version number in:

- `CHANGELOG.md`
- `.goxc.json`
- `README.md`
- `config/version.go`

Expand Down
84 changes: 0 additions & 84 deletions dists/make-release.sh

This file was deleted.