From 8de0e1a25cfa913ebcaa5bd5c8079b5963cd36a8 Mon Sep 17 00:00:00 2001 From: Manfred Touron <94029+moul@users.noreply.github.com> Date: Mon, 3 Jan 2022 20:42:32 +0000 Subject: [PATCH] fix: setup automatic asset publishing Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com> --- .github/workflows/ci.yml | 5 +-- .github/workflows/release.yml | 63 +++++++++++++++++++++++++++++++---- 2 files changed, 59 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6babef869..2c658cfc7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,8 +30,8 @@ jobs: strategy: matrix: golang: - - 1.15.x - 1.16.x + - 1.17.x steps: - uses: actions/checkout@v2 - name: Install Go @@ -47,8 +47,8 @@ jobs: strategy: matrix: golang: - - 1.15.x - 1.16.x + - 1.17.x steps: - uses: actions/checkout@v2 - name: Install Go @@ -73,6 +73,7 @@ jobs: - 1.14.x - 1.15.x - 1.16.x + - 1.17.x steps: - uses: actions/checkout@v2 - name: Install Go diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 27d33efd1..74dc03032 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,13 +1,62 @@ -name: Semantic Release - -on: push +name: Release +on: + push: + branches: + - master + - main jobs: - semantic-release: + release: + name: releaser runs-on: ubuntu-latest + strategy: + matrix: + golang: [1.17.x] steps: - - uses: actions/checkout@master - - uses: codfish/semantic-release-action@v1.9.0 - if: github.ref == 'refs/heads/master' + - + name: Checkout + uses: actions/checkout@v2.4.0 + - + name: Unshallow + run: git fetch --prune --unshallow + - + uses: moul/repoman-action@v1 + id: repoman + - + name: Run Semantic Release + id: semantic + uses: docker://ghcr.io/codfish/semantic-release-action:v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - + name: Set up Go + if: steps.semantic.outputs.new-release-published == 'true' && steps.repoman.outputs.has-go-binary == 'true' + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.golang }} + - + name: Cache Go modules + if: steps.semantic.outputs.new-release-published == 'true' && steps.repoman.outputs.has-go-binary == 'true' + uses: actions/cache@v2.1.7 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ matrix.golang }}-v1-${{ hashFiles('**/go.sum') }} + restore-keys: ${{ runner.os }}-go-${{ matrix.golang }}-v1- + - + name: Run GoReleaser + if: steps.semantic.outputs.new-release-published == 'true' && steps.repoman.outputs.has-go-binary == 'true' + uses: goreleaser/goreleaser-action@v2.8.0 + with: + version: latest + args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - + name: Register version on pkg.go.dev + if: steps.semantic.outputs.new-release-published == 'true' + run: | + package=$(cat go.mod | grep ^module | awk '{print $2}') + version=v${{ steps.semantic.outputs.release-version }} + url=https://proxy.golang.org/${package}/@v/${version}.info + set -x +e + curl -i $url