From 451295bc9ffefcc99323b5989654e1a573462e4b Mon Sep 17 00:00:00 2001 From: Jauder Ho Date: Sat, 1 Jan 2022 09:41:11 -0800 Subject: [PATCH 1/2] Create .goreleaser.yml (#821) Add initial .goreleaser.yml file --- .goreleaser.yml | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .goreleaser.yml diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 000000000..1a2d2d71f --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,60 @@ +# .goreleaser.yml +before: + hooks: + - go mod tidy +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + - freebsd + - aix + goarch: + - 386 + - amd64 + - arm + - arm64 + - s390x + - ppc64le + - ppc64 + - riscv64 + goarm: + - 6 + - 7 + ignore: + - goos: linux + goarch: ppc64 + - goos: darwin + goarch: arm + - goos: darwin + goarch: ppc64le + - goos: darwin + goarch: s390x + - goos: windows + goarch: arm64 + - goos: windows + goarch: arm + - goos: windows + goarch: ppc64le + - goos: windows + goarch: s390x + - goos: freebsd + goarch: arm + - goos: freebsd + goarch: s390x + dir: . + main: ./cmd/mlr + flags: + - -trimpath + #ldflags: + # - -s -w + +checksum: + algorithm: sha256 + +release: + github: + owner: johnkerl + name: miller From d198ad17c2f47d1d2bc108e8a7539be4b877c9fb Mon Sep 17 00:00:00 2001 From: Jauder Ho Date: Sat, 1 Jan 2022 09:41:48 -0800 Subject: [PATCH 2/2] Create release.yml (#822) This is the action that will actually use the .goreleaser.yml file at the root to produce releases --- .github/workflows/release.yml | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..37d97752d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: Release +on: + push: + tags: + - v* + workflow_dispatch: + +env: + GO_VERSION: 1.17.5 + +jobs: + release: + name: Release + strategy: + matrix: + platform: [ubuntu-latest] + runs-on: ${{ matrix.platform }} + steps: + - name: Set up Go + uses: actions/setup-go@v2.1.5 + with: + go-version: ${{ env.GO_VERSION }} + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2.4.0 + with: + fetch-depth: 0 + + # https://github.com/marketplace/actions/cache + - name: Cache Go modules + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + # https://goreleaser.com/ci/actions/ + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + #if: startsWith(github.ref, 'refs/tags/v') + with: + version: latest + args: release -f .goreleaser.yml --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}