Skip to content

Commit

Permalink
add GoReleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-kaestner committed Mar 28, 2022
1 parent 8dd3866 commit 8031cb2
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 8 deletions.
51 changes: 43 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@ name: Go

on:
push:
branches: [ main ]
tags:
- v*
branches:
- main
pull_request:
branches: [ main ]
branches:
- main

permissions:
contents: write

jobs:

Expand All @@ -13,14 +20,14 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.18

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Build
run: go build -v .

Expand All @@ -29,14 +36,14 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.18

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Test
run: go test -v ./...

Expand All @@ -49,3 +56,31 @@ jobs:
# uses: codecov/codecov-action@v2
# with:
# token: ${{ secrets.CODECOV_TOKEN }}

release:
name: Release
needs: [build, test]
runs-on: ubuntu-latest
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Fetch all tags
run: git fetch --force --tags

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.18

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
before:
hooks:
- go mod tidy
builds:
- skip: true
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

0 comments on commit 8031cb2

Please sign in to comment.