Skip to content

Commit c0d1322

Browse files
authored
Merge pull request #450 from gene1wood/gha-build-release
task(workflow): Replace matrix build with GoReleaser for releases
2 parents aad45b2 + 2110ef7 commit c0d1322

6 files changed

Lines changed: 93 additions & 55 deletions

File tree

.github/workflows/bump-version.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version number (x.x.x)'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Set up Go
24+
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
25+
with:
26+
go-version-file: go.mod
27+
28+
- name: Setup Git
29+
run: |
30+
git config user.name 'GitHub Actions'
31+
git config user.email 'actions@github.com'
32+
33+
- name: Create and push tag
34+
run: |
35+
VERSION="${{ inputs.version }}"
36+
git tag -a "v${VERSION}" -m "Release version ${VERSION}"
37+
git push origin "v${VERSION}"
38+
39+
- name: Run GoReleaser
40+
uses: goreleaser/goreleaser-action@e24998b8b67b290c2fa8b7c14fcfa7de2c5c9b8c # v7.1.0
41+
with:
42+
version: "~> v2"
43+
args: release --clean
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- darwin
13+
- windows
14+
goarch:
15+
- amd64
16+
- arm64
17+
ignore:
18+
- goos: windows
19+
goarch: arm64
20+
main: ./cmd/gmailctl
21+
ldflags:
22+
- -s -w -X github.com/mbrt/gmailctl/cmd/gmailctl/cmd.version={{.Version}}
23+
24+
archives:
25+
- formats:
26+
- tar.gz
27+
name_template: "gmailctl_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
28+
format_overrides:
29+
- goos: windows
30+
formats:
31+
- zip
32+
33+
checksum:
34+
name_template: checksums.txt
35+
algorithm: sha256
36+
37+
release:
38+
draft: false
39+
prerelease: auto

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ This project then exists to provide to your Gmail filters:
6767

6868
## Install
6969

70+
Pre-built binaries for Linux, macOS, and Windows (amd64 and arm64) are available
71+
on the [GitHub releases page](https://github.com/mbrt/gmailctl/releases). Download
72+
the archive for your platform, extract it, and place the `gmailctl` binary somewhere
73+
in your `$PATH`.
74+
75+
Alternatively, if you have Go installed, you can build and install from source:
76+
7077
gmailctl is written in Go and requires a recent version (see [go.mod](go.mod)).
7178
Make sure to setup your [`$GOPATH`](https://golang.org/doc/code.html#GOPATH)
7279
correctly and include its `bin` subdirectory in your `$PATH`.
@@ -75,7 +82,7 @@ correctly and include its `bin` subdirectory in your `$PATH`.
7582
go install github.com/mbrt/gmailctl/cmd/gmailctl@latest
7683
```
7784

78-
Alternatively, if you're on macOS, you can install easily via Homebrew or Macports:
85+
If you're on macOS, you can also install via Homebrew or Macports:
7986

8087
```
8188
# Install with Homebrew

cmd/gmailctl/cmd/version.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
package cmd
22

3-
// DO NOT EDIT manually! Generated by hack/update-version.sh
4-
var version = "0.11.0-dev"
3+
var version = "dev"

hack/update-version.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)