Skip to content

Commit

Permalink
ci: use GoReleaser for building releases
Browse files Browse the repository at this point in the history
  • Loading branch information
wowu committed Jul 20, 2022
1 parent dfa7306 commit 0273260
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 22 deletions.
47 changes: 25 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
on:
release:
types: [created]
push:
tags:
- '*'

permissions:
contents: write

jobs:
releases-matrix:
name: Release Go Binary
goreleaser:
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
goos: [linux, windows, darwin]
goarch: ["386", amd64, arm64]
exclude:
- goarch: "386"
goos: darwin
- goarch: arm64
goos: windows
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.RELEASE_SECRET }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "https://dl.google.com/go/go1.18.4.linux-amd64.tar.gz"
binary_name: "pro"
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pro
dist/
14 changes: 14 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
before:
hooks:
- go mod tidy

builds:
- id: windows
goos: [windows]
goarch: [386, amd64]
- id: linux
goos: [linux]
goarch: [386, amd64, arm64]
- id: darwin
goos: [darwin]
goarch: [amd64, arm64]

0 comments on commit 0273260

Please sign in to comment.