Merge pull request #23 from digitalsparky/main

Implement automated workflow for goreleaser builds
This commit is contained in:
HikariKnight 2024-03-30 13:09:38 +01:00 committed by GitHub
commit ee45d29e6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 87 additions and 29 deletions

40
.github/workflows/release.yaml vendored Normal file
View file

@ -0,0 +1,40 @@
name: goreleaser
on:
pull_request:
push:
# run only against tags
tags:
- "*"
permissions:
contents: write
# packages: write
# issues: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
# More assembly might be required: Docker logins, GPG, etc.
# It all depends on your needs.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

47
.goreleaser.yaml Normal file
View file

@ -0,0 +1,47 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
version: 1
before:
hooks:
- go mod tidy
builds:
-
id: "quickpassthrough"
main: ./cmd/main.go
binary: "quickpassthrough"
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
mod_timestamp: "{{ .CommitTimestamp }}"
archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
upx:
-
enabled: true
compress: best
lzma: true
brute: true

View file

@ -1,29 +0,0 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
hooks:
post:
- upx "{{ .Path }}"
archives:
- replacements:
linux: Linux
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
# modelines, feel free to remove those if you don't want/use them:
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj