From e1c10a99454922292a00d3dfa546ff2b43ebfbb5 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Sat, 20 Jan 2024 02:40:09 +0900 Subject: [PATCH] switch to goreleaser --- .github/workflows/release.yml | 19 +++++++------------ .goreleaser.yml | 32 ++++++++++++++++++++++++++++++++ Makefile | 14 ++++---------- 3 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 67d7ac4..557b3b7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,7 @@ on: - "!**/*" tags: - "v*.*.*" + - "v*.*.*-rc*" jobs: release: @@ -18,18 +19,12 @@ jobs: check-latest: true - name: Check out code into the Go module directory - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: setup tools - run: | - mkdir ~/bin - curl -sL https://github.com/Songmu/goxz/releases/download/v0.8.1/goxz_v0.8.1_linux_amd64.tar.gz | tar zxvf - && install goxz_v0.8.1_linux_amd64/goxz ~/bin/ - curl -sL https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz | tar zxvf - && install ghr_v0.13.0_linux_amd64/ghr ~/bin/ - - - name: dist - run: PATH=~/bin:$PATH make dist - - - name: release - run: PATH=~/bin:$PATH make release + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + version: latest + args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..4f912ab --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,32 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +before: + hooks: + - go mod download +builds: + - env: + - CGO_ENABLED=0 + main: ./cmd/lambroll + binary: lambroll + ldflags: + - -s -w + - -X main.Version=v{{.Version}} + goos: + - darwin + - linux + goarch: + - amd64 + - arm64 +release: + prerelease: true +archives: +checksum: + name_template: "checksums.txt" +snapshot: + name_template: "{{ .Env.NIGHTLY_VERSION }}" +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" diff --git a/Makefile b/Makefile index 423351f..395d331 100644 --- a/Makefile +++ b/Makefile @@ -16,17 +16,11 @@ clean: rm -f cmd/lambroll/lambroll rm -fr dist/ -dist: - CGO_ENABLED=0 \ - goxz -pv=$(GIT_VER) \ - -build-ldflags="-s -w -X main.Version=${GIT_VER}" \ - -os=darwin,linux -arch=amd64,arm64 -d=dist ./cmd/lambroll +packages: + goreleaser build --skip-validate --rm-dist -release: - ghr -u fujiwara -r lambroll -n "$(GIT_VER)" $(GIT_VER) dist/ - -prerelease: - ghr -replace -u fujiwara -r lambroll -n "$(GIT_VER)" $(GIT_VER) dist/ +packages-snapshot: + goreleaser build --skip-validate --rm-dist --snapshot orb/publish: circleci orb validate circleci-orb.yml