From 3e61ec86ad6091781b3f76471be44f4d7a01400d Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Wed, 2 Oct 2024 18:24:04 +0300 Subject: [PATCH 1/6] ci: install xcaddy to fix release flow Signed-off-by: Mohammed Al Sahaf --- .github/workflows/release.yml | 4 ++++ .goreleaser.yml | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1eb59e9d02d..d788ca361ff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -104,6 +104,10 @@ jobs: uses: anchore/sbom-action/download-syft@main - name: Syft version run: syft version + - name: Install xcaddy + run: | + go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest + xcaddy version # GoReleaser will take care of publishing those artifacts into the release - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 diff --git a/.goreleaser.yml b/.goreleaser.yml index c7d01571ee4..5c1f7df407f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -13,8 +13,7 @@ before: - cp cmd/caddy/main.go caddy-build/main.go - /bin/sh -c 'cd ./caddy-build && go mod init caddy' # prepare syso files for windows embedding - - go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest - - /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' + - /bin/sh -c 'for a in amd64 arm arm64; do XCADDY_SKIP_BUILD=1 GOOS=windows GOARCH=$a xcaddy build {{.Env.TAG}}; done' - /bin/sh -c 'mv /tmp/buildenv_*/*.syso caddy-build' # GoReleaser doesn't seem to offer {{.Tag}} at this stage, so we have to embed it into the env # so we run: TAG=$(git describe --abbrev=0) goreleaser release --rm-dist --skip-publish --skip-validate From 816cde839d9323e96653de2e72b5f241749abe70 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Wed, 2 Oct 2024 18:29:58 +0300 Subject: [PATCH 2/6] add gorelease smoke test Signed-off-by: Mohammed Al Sahaf --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a74d8cc69b..7a0ce62aa79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -202,3 +202,10 @@ jobs: with: version: latest args: check + + - uses: goreleaser/goreleaser-action@v6 + with: + version: latest + args: build --single-target --auto-snapshot + env: + TAG: "" From 5bcc1f853452a598c52a0688bca1efe4fe416992 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Wed, 2 Oct 2024 18:40:23 +0300 Subject: [PATCH 3/6] amend smoke test command Signed-off-by: Mohammed Al Sahaf --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a0ce62aa79..5eee68f26ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -206,6 +206,6 @@ jobs: - uses: goreleaser/goreleaser-action@v6 with: version: latest - args: build --single-target --auto-snapshot + args: build --single-target --snapshot env: TAG: "" From 20195130c4e9feff77d37410b51aefa5be867482 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Wed, 2 Oct 2024 18:43:00 +0300 Subject: [PATCH 4/6] install xcaddy Signed-off-by: Mohammed Al Sahaf --- .github/workflows/ci.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5eee68f26ed..a88bd17a418 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -202,10 +202,18 @@ jobs: with: version: latest args: check - + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: "~1.23" + check-latest: true + - name: Install xcaddy + run: | + go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest + xcaddy version - uses: goreleaser/goreleaser-action@v6 with: version: latest args: build --single-target --snapshot env: - TAG: "" + TAG: "master" From ceabe0263847646a04898a463293c5c4fd3d976a Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Wed, 2 Oct 2024 18:54:54 +0300 Subject: [PATCH 5/6] fix `manpage` command Signed-off-by: Mohammed Al Sahaf --- cmd/commands.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/commands.go b/cmd/commands.go index 0853ebf8359..33700f8a3bb 100644 --- a/cmd/commands.go +++ b/cmd/commands.go @@ -438,8 +438,7 @@ EXPERIMENTAL: May be changed or removed. }, }) - defaultFactory.Use(func(rootCmd *cobra.Command) { - RegisterCommand(Command{ + RegisterCommand(Command{ Name: "manpage", Usage: "--directory ", Short: "Generates the manual pages for Caddy commands", From 3b0efc8fa2635abf98c99f7995960b6caeaf0934 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Wed, 2 Oct 2024 19:04:43 +0300 Subject: [PATCH 6/6] fix `manpage` command Signed-off-by: Mohammed Al Sahaf --- cmd/commands.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/commands.go b/cmd/commands.go index 33700f8a3bb..ab4b66d7771 100644 --- a/cmd/commands.go +++ b/cmd/commands.go @@ -438,7 +438,8 @@ EXPERIMENTAL: May be changed or removed. }, }) - RegisterCommand(Command{ + defaultFactory.Use(func(rootCmd *cobra.Command) { + rootCmd.AddCommand(caddyCmdToCobra(Command{ Name: "manpage", Usage: "--directory ", Short: "Generates the manual pages for Caddy commands", @@ -468,7 +469,7 @@ argument of --directory. If the directory does not exist, it will be created. return caddy.ExitCodeSuccess, nil }) }, - }) + })) // source: https://github.com/spf13/cobra/blob/main/shell_completions.md rootCmd.AddCommand(&cobra.Command{