Skip to content

Commit

Permalink
Add GoReleaser workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmorgan committed Nov 26, 2024
1 parent d2d8504 commit d355619
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 12 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/go-releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: goreleaser
on:
push:
tags:
- '*'
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
check-latest: true
cache: true
- name: Docker Login
uses: docker/login-action@v3
with:
registry: https://index.docker.io/v1/
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
23 changes: 11 additions & 12 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
builds:
-
binary: fabio
- binary: fabio
env:
- CGO_ENABLED=0
goos:
Expand All @@ -17,25 +17,26 @@ builds:
- arm64
goarm:
- 7

archives:
- id: bin
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}_{{ .Arch }}'
format: binary

source:
enabled: true
name_template: '{{ .ProjectName }}-{{.Version }}.src'
prefix_template: '{{ .ProjectName }}-{{.Version }}/'


checksum:
name_template: '{{.ProjectName}}-{{.Version}}.sha256'

signs:
-
artifacts: checksum

- artifacts: checksum
args:
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}"
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
dockers:
- dockerfile: Dockerfile-goreleaser
use: buildx
Expand All @@ -52,7 +53,6 @@ dockers:
- "--label=org.opencontainers.image.version={{.Version}}"
extra_files:
- fabio.properties

- dockerfile: Dockerfile-goreleaser
use: buildx
goos: linux
Expand All @@ -68,7 +68,6 @@ dockers:
- "--label=org.opencontainers.image.version={{.Version}}"
extra_files:
- fabio.properties

docker_manifests:
- name_template: 'fabiolb/fabio:latest'
image_templates:
Expand Down

0 comments on commit d355619

Please sign in to comment.