From a5f272fc722b0d39d5ced98a5e49ccde44a748c0 Mon Sep 17 00:00:00 2001 From: Ben Maynard Date: Thu, 9 Jul 2020 19:28:58 -0400 Subject: [PATCH 1/2] Use goreleaser to release binary --- .github/workflows/release.yaml | 102 ++++++++------------------------- Dockerfile | 2 - 2 files changed, 25 insertions(+), 79 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9736783..a47e0b8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,80 +1,28 @@ -on: release -name: Build Release +name: release + +on: + pull_request: + push: + jobs: - release-linux-386: - name: release linux/386 + goreleaser: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - name: compile and release - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOARCH: "386" - GOOS: linux - release-linux-amd64: - name: release linux/amd64 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: compile and release - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOARCH: amd64 - GOOS: linux - release-linux-arm: - name: release linux/386 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: compile and release - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOARCH: "arm" - GOOS: linux - release-linux-arm64: - name: release linux/amd64 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: compile and release - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOARCH: arm64 - GOOS: linux - release-darwin-amd64: - name: release darwin/amd64 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: compile and release - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOARCH: amd64 - GOOS: darwin - release-windows-386: - name: release windows/386 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: compile and release - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOARCH: "386" - GOOS: windows - release-windows-amd64: - name: release windows/amd64 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: compile and release - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GOARCH: amd64 - GOOS: windows \ No newline at end of file + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.14 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3783cf8..865cb5a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,4 @@ COPY --from=build-env /src/kubevol /app/ EXPOSE 8080 -RUN mkdir -p /app/mocks - CMD ["/app/kubevol", "watch"] \ No newline at end of file From b3f49701a9fade0e62eba9b7e76edb3e50a773cb Mon Sep 17 00:00:00 2001 From: Ben Maynard Date: Thu, 9 Jul 2020 20:19:55 -0400 Subject: [PATCH 2/2] .goreleaser.yml file --- .github/workflows/release.yaml | 3 ++- .goreleaser.yml | 28 ++++++++++++++++++++++++++++ go.sum | 1 + 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a47e0b8..8e4dff8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,8 +1,9 @@ name: release on: - pull_request: push: + tags: + - '*' jobs: goreleaser: diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..462e720 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,28 @@ +# 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 go modules. + - go mod download + # you may remove this if you don't need go generate + - go generate ./... +builds: +- env: + - CGO_ENABLED=0 +archives: +- replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/go.sum b/go.sum index 70fa5c0..b4d97be 100644 --- a/go.sum +++ b/go.sum @@ -145,6 +145,7 @@ github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=