-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #478 from moul/dev/moul/asset-publishing
fix: setup automatic asset publishing
- Loading branch information
Showing
2 changed files
with
59 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] | ||
if: github.ref == 'refs/heads/master' | ||
- | ||
name: Checkout | ||
uses: actions/[email protected] | ||
- | ||
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/[email protected] | ||
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/[email protected] | ||
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 |