Skip to content

Commit

Permalink
Try goreleaser for library releases (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
FollowTheProcess authored Jun 4, 2023
1 parent 24c1aee commit a9a702d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 22 deletions.
53 changes: 31 additions & 22 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

env:
GO_VERSION: "1.20"

permissions: read-all

jobs:
Expand All @@ -29,16 +26,13 @@ jobs:
- windows-latest

steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Checkout Code
uses: actions/checkout@v3

- name: Download Dependencies
run: go mod download
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod

- name: Run Tests
run: go test -race ./...
Expand All @@ -48,16 +42,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Checkout Code
uses: actions/checkout@v3

- name: Download Dependencies
run: go mod download
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod

- name: Run Tests
run: go test -race -cover -covermode=atomic -coverprofile=./coverage.out ./...
Expand All @@ -72,14 +63,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod

- name: Run Linting
uses: golangci/golangci-lint-action@v3
with:
Expand Down Expand Up @@ -107,12 +98,22 @@ jobs:
- name: Fetch Existing Tags
run: git fetch --force --tags

- name: Install Syft
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: anchore/syft

- name: Parse Release Version
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod

- name: Publish Draft Release
uses: release-drafter/release-drafter@v5
with:
Expand All @@ -121,3 +122,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

29 changes: 29 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
project_name: msg

before:
hooks:
- go mod tidy

builds:
- skip: true

archives:
- id: msg
name_template: >-
{{ .ProjectName }}-
{{- .Version }}
sboms:
- id: msg
artifacts: archive
documents:
- >-
{{ .ProjectName }}-
{{- .Version }}
checksum:
name_template: checksums.txt

changelog:
# The changelog is handled by release drafter
skip: true

0 comments on commit a9a702d

Please sign in to comment.