Skip to content

Commit

Permalink
Add GoReleaser config
Browse files Browse the repository at this point in the history
  • Loading branch information
iBug committed Aug 15, 2024
1 parent 7e9f76f commit cd68036
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 3 deletions.
54 changes: 54 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
version: 2
before:
hooks:
- go mod tidy
builds:
- id: webhook-go
binary: webhook-go
env:
- CGO_ENABLED=0
main: .
goos:
- linux
goarch:
- amd64
flags:
- -trimpath
ldflags:
- -s -w
archives:
- format: binary
name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}"
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
use: github-native
nfpms:
- id: default
package_name: webhook-go
homepage: https://github.com/ustclug-dev/webhook-go
maintainer: "iBug <i@ibugone.com>"
description: |-
A simple webhook for GitHub events
formats:
- deb
umask: 0o022
section: admin
priority: extra
scripts:
postinstall: etc/postinst.sh
preremove: etc/prerm.sh
contents:
- src: README.md
dst: /usr/share/doc/webhook-go/
- src: etc/config.yml
dst: /etc/webhook-go/config.example.yml
- src: etc/webhook-go.service
dst: /lib/systemd/system/


# 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
webhook-go: go.mod $(wildcard *.go)
CGO_ENABLED=0 go build -ldflags='-s -w'
CGO_ENABLED=0 go build -ldflags='-s -w' -trimpath
File renamed without changes.
5 changes: 3 additions & 2 deletions webhook.service → etc/webhook-go.service
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[Unit]
Description=GitHub Webhook
Description=A simple webhook for GitHub events
StartLimitIntervalSec=1
ConditionPathExists=/etc/webhook-go/config.yml

[Service]
Type=simple
Type=exec
ExecStart=/usr/local/bin/webhook-go -config /etc/webhook-go/config.yml
Restart=on-failure
RestartSec=3
Expand Down

0 comments on commit cd68036

Please sign in to comment.