From e8db5dca6ffd6213eba56eaf0c4506ba718b44f5 Mon Sep 17 00:00:00 2001 From: c-bata Date: Thu, 22 Oct 2020 01:44:22 +0900 Subject: [PATCH] Run goreleaser on GitHub Actions --- .github/workflows/release.yml | 24 ++++++++++++++++++++++++ .goreleaser.yml | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..4639bbc3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: release +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 1 + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: 1.15 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + 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 00000000..6c456be6 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,23 @@ +project_name: goptuna +env: + - GO111MODULE=on +before: + hooks: + - go mod tidy +builds: + - main: ./cmd/main.go + binary: goptuna + ldflags: + - -s -w + - -X main.version={{.Version}} + - -X main.revision={{.ShortCommit}} +archives: + - name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' + replacements: + darwin: darwin + linux: linux + 386: i386 + amd64: x86_64 + format: zip +release: + prerelease: auto