diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e2d4e91..4bc7df1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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/go-release-action@v1.30 - 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 }} diff --git a/.gitignore b/.gitignore index 3dbbf0f..72ca0b6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ pro +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..f4461d1 --- /dev/null +++ b/.goreleaser.yaml @@ -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]