Skip to content

Commit de3507a

Browse files
authored
Add binary release workflow (#2)
* Add binary release workflow * Update .gitignore * Only snapshot on ubuntu
1 parent 592ba32 commit de3507a

File tree

6 files changed

+61
-0
lines changed

6 files changed

+61
-0
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ jobs:
3636
skip-pkg-cache: true
3737
skip-build-cache: true
3838
- run: go run mage.go test
39+
- run: go run mage.go snapshot
40+
if: ${{ matrix.os }} == 'ubuntu-22.04'

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Release"
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
build:
10+
name: Release
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
- uses: actions/setup-go@v3
17+
with:
18+
go-version: '^1.18.4'
19+
cache: true
20+
- run: go run mage.go release
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
.envrc
44

55
build
6+
dist

.goreleaser.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
builds:
2+
- main: ./cmd
3+
env:
4+
- CGO_ENABLED=0
5+
targets:
6+
- linux_amd64
7+
- linux_arm64
8+
- darwin_amd64
9+
- darwin_arm64
10+
- windows_amd64
11+
- windows_arm64
12+
archives:
13+
- format_overrides:
14+
- goos: windows
15+
format: zip
16+
release:
17+
mode: append
18+
checksum:
19+
name_template: 'checksums.txt'
20+
snapshot:
21+
name_template: "{{ incpatch .Version }}-next"
22+
changelog:
23+
sort: asc
24+
filters:
25+
exclude:
26+
- '^docs:'
27+
- '^test:'

magefiles/magefile.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ import (
66
"github.com/magefile/mage/sh"
77
)
88

9+
func Snapshot() error {
10+
return sh.RunV("go", "run", fmt.Sprintf("github.com/goreleaser/goreleaser@%s", goReleaserVer), "release", "--snapshot", "--rm-dist")
11+
}
12+
13+
func Release() error {
14+
return sh.RunV("go", "run", fmt.Sprintf("github.com/goreleaser/goreleaser@%s", goReleaserVer), "release", "--rm-dist")
15+
}
16+
917
func Build() error {
1018
return sh.Run("go", "build", "-o", "build/reassign", "./cmd")
1119
}

magefiles/versions.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package main
22

33
var golangCILintVer = "v1.48.0"
4+
var goReleaserVer = "v1.10.3"
45
var gosImportsVer = "v0.1.5"

0 commit comments

Comments
 (0)