Skip to content

Commit

Permalink
Modernise workflows based off of goreleaser (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
kgaughan authored Jul 26, 2024
1 parent fab8fb9 commit ec7944b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ on:
- push
- pull_request

permissions:
contents: read
pull-requests: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
name: check for changes
Expand All @@ -23,7 +27,7 @@ jobs:
- if: steps.changes.outputs.src == 'true'
name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ jobs:
- if: steps.changes.outputs.src == 'true'
uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version-file: go.mod
check-latest: true
cache: true

- if: steps.changes.outputs.src == 'true'
name: Lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.58
version: v1.59.1
args: --issues-exit-code=0
only-new-issues: true
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
packages: write

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
Expand All @@ -48,10 +48,10 @@ jobs:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 5 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
version: 2

before:
hooks:
- go mod tidy
- go mod download

builds:
- env:
Expand All @@ -20,6 +22,7 @@ builds:
- -trimpath
ldflags:
- -s -w -X github.com/kgaughan/mercury/internal/version.Version={{.Version}}
mod_timestamp: "{{ .CommitTimestamp }}"
tags:
- netgo

Expand Down Expand Up @@ -66,7 +69,8 @@ dockers:
dockerfile: Dockerfile

checksum:
name_template: "checksums.txt"
algorithm: sha256
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'

snapshot:
name_template: "{{ incpatch .Version }}-next"
Expand Down

0 comments on commit ec7944b

Please sign in to comment.