Skip to content

Commit 01be1b5

Browse files
authored
ci: install xcaddy to fix release flow (#6602)
1 parent 41f5dd5 commit 01be1b5

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

.github/workflows/ci.yml

+15
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,18 @@ jobs:
202202
with:
203203
version: latest
204204
args: check
205+
- name: Install Go
206+
uses: actions/setup-go@v5
207+
with:
208+
go-version: "~1.23"
209+
check-latest: true
210+
- name: Install xcaddy
211+
run: |
212+
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
213+
xcaddy version
214+
- uses: goreleaser/goreleaser-action@v6
215+
with:
216+
version: latest
217+
args: build --single-target --snapshot
218+
env:
219+
TAG: "master"

.github/workflows/release.yml

+4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ jobs:
104104
uses: anchore/sbom-action/download-syft@main
105105
- name: Syft version
106106
run: syft version
107+
- name: Install xcaddy
108+
run: |
109+
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
110+
xcaddy version
107111
# GoReleaser will take care of publishing those artifacts into the release
108112
- name: Run GoReleaser
109113
uses: goreleaser/goreleaser-action@v6

.goreleaser.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ before:
1313
- cp cmd/caddy/main.go caddy-build/main.go
1414
- /bin/sh -c 'cd ./caddy-build && go mod init caddy'
1515
# prepare syso files for windows embedding
16-
- go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
17-
- /bin/sh -c 'for a in amd64 arm arm64; do XCADDY_SKIP_BUILD=1 GOOS=windows GOARCH=$a $GOPATH/bin/xcaddy build {{.Env.TAG}}; done'
16+
- /bin/sh -c 'for a in amd64 arm arm64; do XCADDY_SKIP_BUILD=1 GOOS=windows GOARCH=$a xcaddy build {{.Env.TAG}}; done'
1817
- /bin/sh -c 'mv /tmp/buildenv_*/*.syso caddy-build'
1918
# GoReleaser doesn't seem to offer {{.Tag}} at this stage, so we have to embed it into the env
2019
# so we run: TAG=$(git describe --abbrev=0) goreleaser release --rm-dist --skip-publish --skip-validate

cmd/commands.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ EXPERIMENTAL: May be changed or removed.
439439
})
440440

441441
defaultFactory.Use(func(rootCmd *cobra.Command) {
442-
RegisterCommand(Command{
442+
rootCmd.AddCommand(caddyCmdToCobra(Command{
443443
Name: "manpage",
444444
Usage: "--directory <path>",
445445
Short: "Generates the manual pages for Caddy commands",
@@ -469,7 +469,7 @@ argument of --directory. If the directory does not exist, it will be created.
469469
return caddy.ExitCodeSuccess, nil
470470
})
471471
},
472-
})
472+
}))
473473

474474
// source: https://github.com/spf13/cobra/blob/main/shell_completions.md
475475
rootCmd.AddCommand(&cobra.Command{

0 commit comments

Comments
 (0)