From 0a93c1ab9b8ab53a745880a9e778d554db6a81b9 Mon Sep 17 00:00:00 2001 From: bambamboole Date: Sun, 25 Dec 2022 22:51:17 +0100 Subject: [PATCH] change workflow to use goreleaser --- .github/workflows/release.yml | 57 +++++++++-------------------------- 1 file changed, 14 insertions(+), 43 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index adcc70d..93175f2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,57 +1,28 @@ name: Release on: - workflow_dispatch: - inputs: - tag: - description: "Tag of the new release" - required: true + push: + # run only against tags + tags: + - '*' jobs: - build: - strategy: - matrix: - goos: [linux, darwin] - arch: [amd64, arm64] + release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags - uses: actions/setup-go@v3 with: go-version-file: './go.mod' - name: Download & verify dependencies run: go mod download && go mod verify - - name: Build - env: - GOOS: ${{ matrix.goos }} - GOARCH: ${{ matrix.arch }} - run: go build -o x-${{ inputs.tag }}-${{ matrix.goos }}-${{ matrix.arch }} cmd/main/main.go - - uses: actions/upload-artifact@v3 + - uses: goreleaser/goreleaser-action@v4 with: - name: binaries - path: ./x-${{ inputs.tag }}-${{ matrix.goos }}-${{ matrix.arch }} - if-no-files-found: error - release: - needs: build - runs-on: ubuntu-latest - outputs: - x_binaries: ${{ steps.files.outputs.x_binaries }} - steps: - - uses: actions/download-artifact@v3 - with: - name: binaries - - name: Build binary list - id: files - run: | - x_binaries=$(ls -R | grep x-) - delimiter="$(openssl rand -hex 8)" - echo "x_binaries<<${delimiter}" >> "${GITHUB_OUTPUT}" - echo "${x_binaries}" >> "${GITHUB_OUTPUT}" - echo "${delimiter}" >> "${GITHUB_OUTPUT}" - - name: create release - uses: softprops/action-gh-release@v1 - with: - generate_release_notes: true - tag_name: ${{ inputs.tag }} - files: | - ${{ steps.files.outputs.x_binaries }} \ No newline at end of file + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }}