From 24d7a98fa98e450fe84614ecd6e9beadaaf47d5c Mon Sep 17 00:00:00 2001 From: Patrick D'appollonio Date: Mon, 30 Aug 2021 20:22:17 -0400 Subject: [PATCH] Replace with Goreleaser. --- .github/workflows/ci.yml | 4 +-- .github/workflows/go-release.yml | 55 ++++++++++++-------------------- .gitignore | 1 + .goreleaser.yml | 31 ++++++++++++++++++ go.mod | 2 +- 5 files changed, 56 insertions(+), 37 deletions(-) create mode 100644 .goreleaser.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 946f799..cdae4ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,8 +10,8 @@ jobs: steps: - name: Clone repository uses: actions/checkout@v2.0.0 - - name: Setup Go - uses: actions/setup-go@v1 + - name: Set up Go + uses: actions/setup-go@v2 with: go-version: 1.16 - name: Test application diff --git a/.github/workflows/go-release.yml b/.github/workflows/go-release.yml index ccbb6fe..c6f7da5 100644 --- a/.github/workflows/go-release.yml +++ b/.github/workflows/go-release.yml @@ -1,39 +1,26 @@ -on: release -name: Release Go Application +name: Release tgen +on: + push: + tags: + - '*' jobs: - release-linux: + goreleaser: runs-on: ubuntu-latest steps: - - name: Clone repository - uses: actions/checkout@v2.0.0 - - name: Compile and release for Linux amd64 - uses: ngs/go-release.action@v1.0.1 + - name: 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: + distribution: goreleaser + version: latest + args: release --rm-dist env: - GITHUB_TOKEN: ${{ github.token }} - GOARCH: amd64 - GOOS: linux - - release-darwin: - runs-on: ubuntu-latest - steps: - - name: Clone repository - uses: actions/checkout@v2.0.0 - - name: Compile and release for Darwin amd64 - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ github.token }} - GOARCH: amd64 - GOOS: darwin - - release-windows: - runs-on: ubuntu-latest - steps: - - name: Clone repository - uses: actions/checkout@v2.0.0 - - name: Compile and release for Windows amd64 - uses: ngs/go-release.action@v1.0.1 - env: - GITHUB_TOKEN: ${{ github.token }} - GOARCH: amd64 - GOOS: windows + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 32e1ef9..f50888b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ tgen tests/ +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..ea94866 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,31 @@ +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm + - arm64 + tags: + - netgo + flags: + - -trimpath + ldflags: + - '-s -w -extldflags "-static"' +archives: + - replacements: + 386: i386 + amd64: x86_64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/go.mod b/go.mod index f2a7620..71bfa61 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/patrickdappollonio/tgen require github.com/spf13/cobra v1.2.1 -go 1.14 +go 1.16