Skip to content

Commit

Permalink
workflow: simplify configs and goreleaser pattern (#4)
Browse files Browse the repository at this point in the history
* workflow: simplify configs and goreleaser pattern
* reorder checkout + setup-go
  • Loading branch information
jimschubert authored Jan 16, 2023
1 parent 13d4967 commit 65bdd58
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 32 deletions.
31 changes: 16 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
# Version here has to match one returned via https://golang.org/dl/?mode=json&include=all
go-version: '1.17'
go-version-file: go.mod
id: go

- name: Checkout
uses: actions/checkout@v2

- name: Cache go module
uses: actions/cache@v2
with:
Expand All @@ -44,20 +45,20 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: '1.17'
go-version-file: go.mod

- name: GoReleaser
uses: goreleaser/goreleaser-action@v2.7.0
uses: goreleaser/goreleaser-action@v4
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
Expand All @@ -79,7 +80,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -100,9 +101,9 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: '1.17'
go-version-file: go.mod

- name: Find Last Tag
id: last
Expand Down Expand Up @@ -136,12 +137,12 @@ jobs:
run: cat .github/CHANGELOG.md

- name: Check goreleaser
uses: goreleaser/goreleaser-action@v2.7.0
uses: goreleaser/goreleaser-action@v4
with:
args: check

- name: Execute goreleaser
uses: goreleaser/goreleaser-action@v2.7.0
uses: goreleaser/goreleaser-action@v4
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ jobs:
name: Lint with golangci
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
with:
go-version: ~1.17
- uses: actions/checkout@v2
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ jobs:
runs-on: ubuntu-latest
steps:

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

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
# Version here has to match one returned via https://golang.org/dl/?mode=json&include=all
go-version: '1.17'
go-version-file: go.mod
id: go

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

- name: Cache go module
uses: actions/cache@v2
with:
Expand Down
10 changes: 2 additions & 8 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,9 @@ builds:
# Default is `.`.
main: ./cmd/docked/
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64

- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
format: tar.gz

rlcp: true
format_overrides:
- goos: windows
format: zip
Expand Down

0 comments on commit 65bdd58

Please sign in to comment.