Skip to content

Commit 040767f

Browse files
committed
Add GoReleaser workflow.
1 parent d2d8504 commit 040767f

File tree

2 files changed

+55
-12
lines changed

2 files changed

+55
-12
lines changed

.github/workflows/go-releaser.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: goreleaser
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
permissions:
7+
contents: write
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v3
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version-file: 'go.mod'
22+
check-latest: true
23+
cache: true
24+
- name: Docker Login
25+
uses: docker/login-action@v3
26+
with:
27+
registry: https://index.docker.io/v1/
28+
username: ${{ secrets.DOCKER_HUB_USER }}
29+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
30+
- name: Import GPG key
31+
id: import_gpg
32+
uses: crazy-max/ghaction-import-gpg@v6
33+
with:
34+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
35+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
36+
- name: Run GoReleaser
37+
uses: goreleaser/goreleaser-action@v6
38+
with:
39+
distribution: goreleaser
40+
version: '~> v2'
41+
args: release --clean
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

.goreleaser.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
version: 2
12
builds:
2-
-
3-
binary: fabio
3+
- binary: fabio
44
env:
55
- CGO_ENABLED=0
66
goos:
@@ -17,25 +17,26 @@ builds:
1717
- arm64
1818
goarm:
1919
- 7
20-
2120
archives:
2221
- id: bin
2322
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}_{{ .Arch }}'
2423
format: binary
25-
2624
source:
2725
enabled: true
2826
name_template: '{{ .ProjectName }}-{{.Version }}.src'
2927
prefix_template: '{{ .ProjectName }}-{{.Version }}/'
30-
31-
3228
checksum:
3329
name_template: '{{.ProjectName}}-{{.Version}}.sha256'
34-
3530
signs:
36-
-
37-
artifacts: checksum
38-
31+
- artifacts: checksum
32+
args:
33+
- "--batch"
34+
- "--local-user"
35+
- "{{ .Env.GPG_FINGERPRINT }}"
36+
- "--output"
37+
- "${signature}"
38+
- "--detach-sign"
39+
- "${artifact}"
3940
dockers:
4041
- dockerfile: Dockerfile-goreleaser
4142
use: buildx
@@ -52,7 +53,6 @@ dockers:
5253
- "--label=org.opencontainers.image.version={{.Version}}"
5354
extra_files:
5455
- fabio.properties
55-
5656
- dockerfile: Dockerfile-goreleaser
5757
use: buildx
5858
goos: linux
@@ -68,7 +68,6 @@ dockers:
6868
- "--label=org.opencontainers.image.version={{.Version}}"
6969
extra_files:
7070
- fabio.properties
71-
7271
docker_manifests:
7372
- name_template: 'fabiolb/fabio:latest'
7473
image_templates:

0 commit comments

Comments
 (0)