@marcel91200 / caddy Mirror · read-only / commits / 0fa1a3b6
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

ci: preliminary CD with goreleaser (#3173)

* chore: ci: preliminary CD support * chore: ci: split release process into its own workflow * chore: ci: cleanup the ci.yml and .goreleaser.yml * chore: ci: unshallowify the clone before searching for the closes tag * chore: tidy up goreleaser config & the release githubaction * chore: add --no-tty to gpg args * chore: more gpg args * chore: try with default gpg args by goreleaser * chore: gpg... * chore: set GPG_TTY * chore: preset gpg conf * Apply suggestions from code review chore: tidy up the .goreleaser.yml Co-Authored-By: Dave Henderson <dhenderson@gmail.com> * chore: gpg debugging * chore: set and export the tty for gpg * chore: gpg.. * chore: use the exact same line from goreleaser-action README for singing * chore: remove signing stanzas from ymls * chore: clean up the release action for final submission * quote the arguments of echo Co-Authored-By: Francis Lavoie <lavofr@gmail.com> Co-authored-by: Dave Henderson <dhenderson@gmail.com> Co-authored-by: Francis Lavoie <lavofr@gmail.com>

Mohammed Al Sahaf committed Mar 25, 2020 at 08:13 UTC 0fa1a3b630eccc15854c5ac2ecf95c856e22cbb3
3 files changed +124
.github/workflows/release.yml new
+53
@@ -0,0 +1,53 @@
1 +name: Release
2 +
3 +on:
4 + push:
5 + tags:
6 + - 'v*.*.*'
7 +
8 +jobs:
9 + release:
10 + name: Release
11 + strategy:
12 + matrix:
13 + os: [ ubuntu-latest ]
14 + go-version: [ 1.14.x ]
15 + runs-on: ${{ matrix.os }}
16 +
17 + steps:
18 + - name: Install Go
19 + uses: actions/setup-go@v1
20 + with:
21 + go-version: ${{ matrix.go-version }}
22 +
23 + - name: Checkout code
24 + uses: actions/checkout@v2
25 +
26 + # So GoReleaser can generate the changelog properly
27 + - name: Unshallowify the repo clone
28 + run: git fetch --prune --unshallow
29 +
30 + - name: Print Go version and environment
31 + id: vars
32 + run: |
33 + printf "Using go at: $(which go)\n"
34 + printf "Go version: $(go version)\n"
35 + printf "\n\nGo environment:\n\n"
36 + go env
37 + printf "\n\nSystem environment:\n\n"
38 + env
39 +
40 + # https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
41 + - name: Get the version
42 + id: get_version
43 + run: echo "::set-output name=version_tag::${GITHUB_REF/refs\/tags\//}"
44 +
45 + # GoReleaser will take care of publishing those artifacts into the release
46 + - name: Run GoReleaser
47 + uses: goreleaser/goreleaser-action@v1
48 + with:
49 + version: latest
50 + args: release --rm-dist
51 + env:
52 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53 + TAG: ${{ steps.vars.outputs.version_tag }}
.gitignore
+5
@@ -16,3 +16,8 @@ cmd/caddy/caddy.exe
16
17 # go modules
18 vendor
19 +
20 +# goreleaser artifacts
21 +dist
22 +caddy-build
23 +caddy-dist
\ No newline at end of file
.goreleaser.yml new
+66
@@ -0,0 +1,66 @@
1 +before:
2 + hooks:
3 + - mkdir -p caddy-build
4 + - cp cmd/caddy/main.go caddy-build/main.go
5 + - cp ./go.mod caddy-build/go.mod
6 + - sed -i.bkp s/github.com\/caddyserver\/caddy\/v2/caddy/g ./caddy-build/go.mod
7 + # GoReleaser doesn't seem to offer {{.Tag}} at this stage, so we have to embed it into the env
8 + # so we run: TAG=$(git describe --abbrev=0) goreleaser release --rm-dist --skip-publish --skip-validate
9 + - go mod edit -require=github.com/caddyserver/caddy/v2@{{.Env.TAG}} ./caddy-build/go.mod
10 + - git clone --depth 1 https://github.com/caddyserver/dist caddy-dist
11 + - go mod download
12 +builds:
13 +- env:
14 + - CGO_ENABLED=0
15 + - GO111MODULE=on
16 + main: main.go
17 + dir: ./caddy-build
18 + binary: caddy
19 + goos:
20 + - darwin
21 + - linux
22 + - windows
23 + - freebsd
24 + goarch:
25 + - amd64
26 + - 386
27 + - arm
28 + - arm64
29 + goarm:
30 + - 6
31 + - 7
32 + ignore:
33 + - goos: darwin
34 + goarch: 386
35 + - goos: darwin
36 + goarch: arm
37 + flags:
38 + - -trimpath
39 + ldflags:
40 + - -s -w
41 +archives:
42 + - format_overrides:
43 + - goos: windows
44 + format: zip
45 + replacements:
46 + darwin: macOS
47 + linux: Linux
48 + windows: Windows
49 + 386: i386
50 + amd64: x86_64
51 +checksum:
52 + algorithm: sha512
53 +release:
54 + github:
55 + owner: caddyserver
56 + name: caddy
57 + draft: true
58 + prerelease: auto
59 +changelog:
60 + sort: asc
61 + filters:
62 + exclude:
63 + - '^docs:'
64 + - '^test:'
65 + - '^chore:'
66 + - '^\w+\s+' # a hack to remove commit messages without colons thus don't correspond to a package