Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 10, 22:30 UTC
| 1 | version: 2 |
| 2 | |
| 3 | before: |
| 4 | hooks: |
| 5 | # The build is done in this particular way to build Caddy in a designated directory named in .gitignore. |
| 6 | # This is so we can run goreleaser on tag without Git complaining of being dirty. The main.go in cmd/caddy directory |
| 7 | # cannot be built within that directory due to changes necessary for the build causing Git to be dirty, which |
| 8 | # subsequently causes gorleaser to refuse running. |
| 9 | - rm -rf caddy-build caddy-dist vendor |
| 10 | # vendor Caddy deps |
| 11 | - go mod vendor |
| 12 | - mkdir -p caddy-build |
| 13 | - cp cmd/caddy/main.go caddy-build/main.go |
| 14 | - /bin/sh -c 'cd ./caddy-build && go mod init caddy' |
| 15 | # prepare syso files for windows embedding |
| 16 | - /bin/sh -c 'for a in amd64 arm64; do XCADDY_SKIP_BUILD=1 GOOS=windows GOARCH=$a xcaddy build {{.Env.TAG}}; done' |
| 17 | - /bin/sh -c 'mv /tmp/buildenv_*/*.syso caddy-build' |
| 18 | # GoReleaser doesn't seem to offer {{.Tag}} at this stage, so we have to embed it into the env |
| 19 | # so we run: TAG=$(git describe --abbrev=0) goreleaser release --rm-dist --skip-publish --skip-validate |
| 20 | - go mod edit -require=github.com/caddyserver/caddy/v2@{{.Env.TAG}} ./caddy-build/go.mod |
| 21 | # as of Go 1.16, `go` commands no longer automatically change go.{mod,sum}. We now have to explicitly |
| 22 | # run `go mod tidy`. The `/bin/sh -c '...'` is because goreleaser can't find cd in PATH without shell invocation. |
| 23 | - /bin/sh -c 'cd ./caddy-build && go mod tidy' |
| 24 | # vendor the deps of the prepared to-build module |
| 25 | - /bin/sh -c 'cd ./caddy-build && go mod vendor' |
| 26 | - git clone --depth 1 https://github.com/caddyserver/dist caddy-dist |
| 27 | - mkdir -p caddy-dist/man |
| 28 | - go mod download |
| 29 | - go run cmd/caddy/main.go manpage --directory ./caddy-dist/man |
| 30 | - gzip -r ./caddy-dist/man/ |
| 31 | - /bin/sh -c 'go run cmd/caddy/main.go completion bash > ./caddy-dist/scripts/bash-completion' |
| 32 | |
| 33 | builds: |
| 34 | - env: |
| 35 | - CGO_ENABLED=0 |
| 36 | - GO111MODULE=on |
| 37 | dir: ./caddy-build |
| 38 | binary: caddy |
| 39 | goos: |
| 40 | - darwin |
| 41 | - linux |
| 42 | - windows |
| 43 | - freebsd |
| 44 | goarch: |
| 45 | - amd64 |
| 46 | - arm |
| 47 | - arm64 |
| 48 | - s390x |
| 49 | - ppc64le |
| 50 | - riscv64 |
| 51 | goarm: |
| 52 | - "5" |
| 53 | - "6" |
| 54 | - "7" |
| 55 | ignore: |
| 56 | - goos: darwin |
| 57 | goarch: arm |
| 58 | - goos: darwin |
| 59 | goarch: ppc64le |
| 60 | - goos: darwin |
| 61 | goarch: s390x |
| 62 | - goos: darwin |
| 63 | goarch: riscv64 |
| 64 | - goos: windows |
| 65 | goarch: ppc64le |
| 66 | - goos: windows |
| 67 | goarch: s390x |
| 68 | - goos: windows |
| 69 | goarch: riscv64 |
| 70 | - goos: windows |
| 71 | goarch: arm |
| 72 | - goos: freebsd |
| 73 | goarch: ppc64le |
| 74 | - goos: freebsd |
| 75 | goarch: s390x |
| 76 | - goos: freebsd |
| 77 | goarch: riscv64 |
| 78 | - goos: freebsd |
| 79 | goarch: arm |
| 80 | goarm: "5" |
| 81 | flags: |
| 82 | - -trimpath |
| 83 | - -mod=readonly |
| 84 | ldflags: |
| 85 | - -s -w |
| 86 | tags: |
| 87 | - nobadger |
| 88 | - nomysql |
| 89 | - nopgx |
| 90 | |
| 91 | signs: |
| 92 | - cmd: cosign |
| 93 | signature: "${artifact}.sigstore.json" |
| 94 | args: ["sign-blob", "--yes", "--bundle=${signature}", "${artifact}"] |
| 95 | artifacts: all |
| 96 | |
| 97 | sboms: |
| 98 | - artifacts: binary |
| 99 | documents: |
| 100 | - >- |
| 101 | {{ .ProjectName }}_ |
| 102 | {{- .Version }}_ |
| 103 | {{- if eq .Os "darwin" }}mac{{ else }}{{ .Os }}{{ end }}_ |
| 104 | {{- .Arch }} |
| 105 | {{- with .Arm }}v{{ . }}{{ end }} |
| 106 | {{- with .Mips }}_{{ . }}{{ end }} |
| 107 | {{- if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}.sbom |
| 108 | cmd: syft |
| 109 | args: ["$artifact", "--file", "${document}", "--output", "cyclonedx-json"] |
| 110 | |
| 111 | archives: |
| 112 | - id: default |
| 113 | format_overrides: |
| 114 | - goos: windows |
| 115 | formats: zip |
| 116 | name_template: >- |
| 117 | {{ .ProjectName }}_ |
| 118 | {{- .Version }}_ |
| 119 | {{- if eq .Os "darwin" }}mac{{ else }}{{ .Os }}{{ end }}_ |
| 120 | {{- .Arch }} |
| 121 | {{- with .Arm }}v{{ . }}{{ end }} |
| 122 | {{- with .Mips }}_{{ . }}{{ end }} |
| 123 | {{- if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }} |
| 124 | |
| 125 | # package the 'caddy-build' directory into a tarball, |
| 126 | # allowing users to build the exact same set of files as ours. |
| 127 | - id: source |
| 128 | meta: true |
| 129 | name_template: "{{ .ProjectName }}_{{ .Version }}_buildable-artifact" |
| 130 | files: |
| 131 | - src: LICENSE |
| 132 | dst: ./LICENSE |
| 133 | - src: README.md |
| 134 | dst: ./README.md |
| 135 | - src: AUTHORS |
| 136 | dst: ./AUTHORS |
| 137 | - src: ./caddy-build |
| 138 | dst: ./ |
| 139 | |
| 140 | source: |
| 141 | enabled: true |
| 142 | name_template: '{{ .ProjectName }}_{{ .Version }}_src' |
| 143 | format: 'tar.gz' |
| 144 | |
| 145 | # Additional files/template/globs you want to add to the source archive. |
| 146 | # |
| 147 | # Default: empty. |
| 148 | files: |
| 149 | - vendor |
| 150 | |
| 151 | |
| 152 | checksum: |
| 153 | algorithm: sha512 |
| 154 | |
| 155 | nfpms: |
| 156 | - id: default |
| 157 | package_name: caddy |
| 158 | |
| 159 | vendor: Dyanim |
| 160 | homepage: https://caddyserver.com |
| 161 | maintainer: Matthew Holt <mholt@users.noreply.github.com> |
| 162 | description: | |
| 163 | Caddy - Powerful, enterprise-ready, open source web server with automatic HTTPS written in Go |
| 164 | license: Apache 2.0 |
| 165 | |
| 166 | formats: |
| 167 | - deb |
| 168 | # - rpm |
| 169 | |
| 170 | bindir: /usr/bin |
| 171 | contents: |
| 172 | - src: ./caddy-dist/init/caddy.service |
| 173 | dst: /lib/systemd/system/caddy.service |
| 174 | |
| 175 | - src: ./caddy-dist/init/caddy-api.service |
| 176 | dst: /lib/systemd/system/caddy-api.service |
| 177 | |
| 178 | - src: ./caddy-dist/welcome/index.html |
| 179 | dst: /usr/share/caddy/index.html |
| 180 | |
| 181 | - src: ./caddy-dist/scripts/bash-completion |
| 182 | dst: /etc/bash_completion.d/caddy |
| 183 | |
| 184 | - src: ./caddy-dist/config/Caddyfile |
| 185 | dst: /etc/caddy/Caddyfile |
| 186 | type: config |
| 187 | |
| 188 | - src: ./caddy-dist/man/* |
| 189 | dst: /usr/share/man/man8/ |
| 190 | |
| 191 | scripts: |
| 192 | postinstall: ./caddy-dist/scripts/postinstall.sh |
| 193 | preremove: ./caddy-dist/scripts/preremove.sh |
| 194 | postremove: ./caddy-dist/scripts/postremove.sh |
| 195 | |
| 196 | provides: |
| 197 | - httpd |
| 198 | |
| 199 | release: |
| 200 | github: |
| 201 | owner: caddyserver |
| 202 | name: caddy |
| 203 | draft: true |
| 204 | prerelease: auto |
| 205 | |
| 206 | # Only used for local runs: the release workflow passes --release-notes |
| 207 | # generated by .github/scripts/release-notes.sh, which skips this. |
| 208 | changelog: |
| 209 | sort: asc |
| 210 | filters: |
| 211 | exclude: |
| 212 | - '^chore:' |
| 213 | - '^ci:' |
| 214 | - '^docs?:' |
| 215 | - '^readme:' |
| 216 | - '^tests?:' |
| 217 | - '^\w+\s+' # a hack to remove commit messages without colons thus don't correspond to a package |