Skip to content

Commit

Permalink
Merge pull request #346 from fujiwara/goreleaser
Browse files Browse the repository at this point in the history
switch to goreleaser
  • Loading branch information
fujiwara authored Jan 19, 2024
2 parents ae04665 + e1c10a9 commit 042aba5
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 22 deletions.
19 changes: 7 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
- "!**/*"
tags:
- "v*.*.*"
- "v*.*.*-rc*"

jobs:
release:
Expand All @@ -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 }}
32 changes: 32 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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:"
14 changes: 4 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 042aba5

Please # to comment.