From 8ccc046d65072dc981dd2cb97e48c7c83dbb65d0 Mon Sep 17 00:00:00 2001 From: b4b4r07 Date: Thu, 3 Feb 2022 01:43:50 +0900 Subject: [PATCH] Release workflow --- .github/workflows/release.yaml | 24 ++++++++++++++++++++++++ .goreleaser.yaml | 29 +++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .github/workflows/release.yaml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..6de855c --- /dev/null +++ b/.github/workflows/release.yaml @@ -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@v1 + with: + fetch-depth: 1 + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: 1.13 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..e6538f6 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,29 @@ +project_name: afx +env: + - GO111MODULE=on +before: + hooks: + - go mod tidy +builds: + - main: . + binary: afx + ldflags: + - -s -w + - -X github.com/b4b4r07/afx/cmd.Version={{.Version}} + - -X github.com/b4b4r07/afx/cmd.BuildTag={{.Tag}} + - -X github.com/b4b4r07/afx/cmd.BuildSHA={{.ShortCommit}} + env: + - CGO_ENABLED=0 +archives: + - name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' + replacements: + darwin: darwin + linux: linux + windows: windows + 386: i386 + amd64: x86_64 + format_overrides: + - goos: windows + format: zip +release: + prerelease: auto