diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ff1e5e..a5cc12e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,28 +1,42 @@ -name: Release Go binaries +name: goreleaser on: - release: - types: [created] + push: + # run only against tags + tags: + - '*' + +permissions: + contents: write + # packages: write + # issues: write jobs: - releases-matrix: - name: Release Go Binary + goreleaser: runs-on: ubuntu-latest - strategy: - matrix: - # build and publish in parallel: linux/amd64 - goos: [linux, darwin, windows] - goarch: [amd64, arm64, arm, 386] steps: - - uses: actions/checkout@v2 - - name: Run tests - run: go test -v -p=1 -timeout=0 ./... - - uses: wangyoucao577/go-release-action@v1.16 + - + name: Checkout + uses: actions/checkout@v2 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - goos: ${{ matrix.goos }} - goarch: ${{ matrix.goarch }} - project_path: "." - binary_name: "GoShod" - ldflags: "-s -w" - extra_files: LICENSE README.md + 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: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution + # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}