mirror of
https://github.com/adnanh/webhook.git
synced 2025-08-01 15:30:30 +00:00
chore: add goreleaser
This commit is contained in:
parent
6c8316730c
commit
9e754e8664
3 changed files with 125 additions and 6 deletions
117
.goreleaser.yaml
Normal file
117
.goreleaser.yaml
Normal file
|
@ -0,0 +1,117 @@
|
|||
project_name: hbh
|
||||
|
||||
builds:
|
||||
- <<: &build_defaults
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
ldflags:
|
||||
- -w -s -X "github.com/soulteary/webhook/internal/version/version.Version={{ .Tag }}"
|
||||
id: macos
|
||||
goos: [ darwin ]
|
||||
goarch: [ amd64, arm64 ]
|
||||
|
||||
- <<: *build_defaults
|
||||
id: linux
|
||||
goos: [linux]
|
||||
goarch: ["386", arm, amd64, arm64]
|
||||
goarm:
|
||||
- "7"
|
||||
- "6"
|
||||
|
||||
dockers:
|
||||
|
||||
- image_templates:
|
||||
- "soulteary/webhook:linux-amd64-{{ .Tag }}"
|
||||
- "soulteary/webhook:linux-amd64"
|
||||
dockerfile: docker/Dockerfile.gorelease
|
||||
use: buildx
|
||||
goarch: amd64
|
||||
build_flag_templates:
|
||||
- "--pull"
|
||||
- "--platform=linux/amd64"
|
||||
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
|
||||
- "--label=org.opencontainers.image.description={{ .ProjectName }}"
|
||||
- "--label=org.opencontainers.image.url=https://github.com/soulteary/webhook"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/soulteary/webhook"
|
||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||
- "--label=org.opencontainers.image.created={{ .Date }}"
|
||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||
- "--label=org.opencontainers.image.licenses=Apache-v2"
|
||||
|
||||
- image_templates:
|
||||
- "soulteary/webhook:linux-arm64-{{ .Tag }}"
|
||||
- "soulteary/webhook:linux-arm64"
|
||||
dockerfile: docker/Dockerfile.gorelease
|
||||
use: buildx
|
||||
goos: linux
|
||||
goarch: arm64
|
||||
goarm: ''
|
||||
build_flag_templates:
|
||||
- "--pull"
|
||||
- "--platform=linux/arm64"
|
||||
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
|
||||
- "--label=org.opencontainers.image.description={{ .ProjectName }}"
|
||||
- "--label=org.opencontainers.image.url=https://github.com/soulteary/webhook"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/soulteary/webhook"
|
||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||
- "--label=org.opencontainers.image.created={{ .Date }}"
|
||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||
- "--label=org.opencontainers.image.licenses=Apache-v2"
|
||||
|
||||
- image_templates:
|
||||
- "soulteary/webhook:linux-armv7-{{ .Tag }}"
|
||||
- "soulteary/webhook:linux-armv7"
|
||||
dockerfile: docker/Dockerfile.gorelease
|
||||
use: buildx
|
||||
goos: linux
|
||||
goarch: arm
|
||||
goarm: "7"
|
||||
build_flag_templates:
|
||||
- "--pull"
|
||||
- "--platform=linux/arm/v7"
|
||||
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
|
||||
- "--label=org.opencontainers.image.description={{ .ProjectName }}"
|
||||
- "--label=org.opencontainers.image.url=https://github.com/soulteary/webhook"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/soulteary/webhook"
|
||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||
- "--label=org.opencontainers.image.created={{ .Date }}"
|
||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||
- "--label=org.opencontainers.image.licenses=Apache-v2"
|
||||
|
||||
- image_templates:
|
||||
- "soulteary/webhook:linux-armv6-{{ .Tag }}"
|
||||
- "soulteary/webhook:linux-armv6"
|
||||
dockerfile: docker/Dockerfile.gorelease
|
||||
use: buildx
|
||||
goos: linux
|
||||
goarch: arm
|
||||
goarm: "6"
|
||||
build_flag_templates:
|
||||
- "--pull"
|
||||
- "--platform=linux/arm/v6"
|
||||
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
|
||||
- "--label=org.opencontainers.image.description={{ .ProjectName }}"
|
||||
- "--label=org.opencontainers.image.url=https://github.com/soulteary/webhook"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/soulteary/webhook"
|
||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||
- "--label=org.opencontainers.image.created={{ .Date }}"
|
||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||
- "--label=org.opencontainers.image.licenses=Apache-v2"
|
||||
|
||||
|
||||
docker_manifests:
|
||||
- name_template: "soulteary/webhook:{{ .Tag }}"
|
||||
image_templates:
|
||||
- "soulteary/webhook:linux-amd64-{{ .Tag }}"
|
||||
- "soulteary/webhook:linux-arm64-{{ .Tag }}"
|
||||
- "soulteary/webhook:linux-armv7-{{ .Tag }}"
|
||||
- "soulteary/webhook:linux-armv6-{{ .Tag }}"
|
||||
skip_push: "false"
|
||||
|
||||
- name_template: "soulteary/webhook:latest"
|
||||
image_templates:
|
||||
- "soulteary/webhook:linux-amd64-{{ .Tag }}"
|
||||
- "soulteary/webhook:linux-arm64-{{ .Tag }}"
|
||||
- "soulteary/webhook:linux-armv7-{{ .Tag }}"
|
||||
- "soulteary/webhook:linux-armv6-{{ .Tag }}"
|
||||
skip_push: "false"
|
5
internal/version/version.go
Normal file
5
internal/version/version.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package version
|
||||
|
||||
var (
|
||||
Version = "2.8.0"
|
||||
)
|
|
@ -21,16 +21,13 @@ import (
|
|||
"github.com/adnanh/webhook/internal/middleware"
|
||||
"github.com/adnanh/webhook/internal/pidfile"
|
||||
"github.com/adnanh/webhook/internal/platform"
|
||||
"github.com/adnanh/webhook/internal/version"
|
||||
|
||||
chimiddleware "github.com/go-chi/chi/middleware"
|
||||
"github.com/gorilla/mux"
|
||||
fsnotify "gopkg.in/fsnotify.v1"
|
||||
)
|
||||
|
||||
const (
|
||||
version = "2.8.0"
|
||||
)
|
||||
|
||||
var (
|
||||
ip = flag.String("ip", "0.0.0.0", "ip the webhook should serve hooks on")
|
||||
port = flag.Int("port", 9000, "port the webhook should serve hooks on")
|
||||
|
@ -105,7 +102,7 @@ func main() {
|
|||
flag.Parse()
|
||||
|
||||
if *justDisplayVersion {
|
||||
fmt.Println("webhook version " + version)
|
||||
fmt.Println("webhook version " + version.Version)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
|
@ -196,7 +193,7 @@ func main() {
|
|||
}()
|
||||
}
|
||||
|
||||
log.Println("version " + version + " starting")
|
||||
log.Println("version " + version.Version + " starting")
|
||||
|
||||
// set os signal watcher
|
||||
platform.SetupSignals(signals, reloadAllHooks, pidFile)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue