Skip to content

Commit

Permalink
use GoReleaser instead
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Jul 17, 2023
1 parent c975635 commit 1b1640a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 29 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ jobs:
sed '1d' profile.cov >> ../profile.cov
working-directory: ./caddy

- name: Print version information
run: go run main.go version
working-directory: ./caddy/mercure

- name: Upload coverage results
uses: shogo82148/actions-goveralls@v1
with:
Expand Down
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ env:
builds:
- id: caddy
dir: caddy/mercure
ldflags:
- -X 'github.com/caddyserver/caddy/v2.CustomVersion=Mercure.rocks {{ .Version }} Caddy'
goos:
- linux
- darwin
Expand Down
26 changes: 1 addition & 25 deletions caddy/mercure/main.go
Original file line number Diff line number Diff line change
@@ -1,38 +1,14 @@
// Adapted from https://github.com/caddyserver/xcaddy/blob/b7fd102f41e12be4735dc77b0391823989812ce8/environment.go#L251
// Copied from https://github.com/caddyserver/xcaddy/blob/b7fd102f41e12be4735dc77b0391823989812ce8/environment.go#L251
package main

import (
"fmt"
"runtime/debug"

caddy "github.com/caddyserver/caddy/v2"
caddycmd "github.com/caddyserver/caddy/v2/cmd"

// plug in Caddy modules here.
_ "github.com/caddyserver/caddy/v2/modules/standard"
_ "github.com/dunglas/mercure/caddy"
)

//nolint:gochecknoinits
func init() {
if caddy.CustomVersion != "" {
return
}

version := "(unknown)"
if bi, ok := debug.ReadBuildInfo(); ok {
for _, m := range bi.Deps {
if m.Path == "github.com/dunglas/mercure" {
version = m.Version

break
}
}
}

caddy.CustomVersion = fmt.Sprintf("Mercure.rocks %s Caddy", version)
}

func main() {
caddycmd.Main()
}

0 comments on commit 1b1640a

Please sign in to comment.