@marcel91200 / caddy Mirror · read-only / commits / 768383a6
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: Enable GoReleaser .deb support (#3309)

* ci: Enable GoReleaser .deb support * ci: Test .deb build * ci: Fix typo * ci: Turn off snapshot (breaks due to go mod edit) * ci: Force the tag to rc3 for now * ci: Let's try to publish the .debs * ci: Attempt to enable build cache, rebuild after fixed line endings * ci: Fix yml dupe ID issue, add caddy-api.service * ci: Split cache keys between files so they're separate * ci: Fix bindir * ci: Update the script files * ci: Retrigger * ci: Push to gemfury * ci: Use loop, fix bad env var * ci: Retrigger * ci: Try to force blank password? * ci: Check if the token is actually present * ci: Cleanup, remove debugging stuff * ci: Remove useless comment

Francis Lavoie committed Apr 26, 2020 at 22:20 UTC 768383a610d529e72ccf34b05822c60616cbcada
3 files changed +57 -9
.github/workflows/ci.yml
+2 -2
@@ -72,9 +72,9 @@ jobs:
72 uses: actions/cache@v1
73 with:
74 path: ${{ steps.vars.outputs.go_cache }}
75 - key: ${{ runner.os }}-go-gocache-${{ hashFiles('**/go.sum') }}
75 + key: ${{ runner.os }}-go-ci-${{ hashFiles('**/go.sum') }}
76 restore-keys: |
77 - ${{ runner.os }}-go-
77 + ${{ runner.os }}-go-ci
78
79 - name: Get dependencies
80 run: |
.github/workflows/release.yml
+21 -6
@@ -27,6 +27,7 @@ jobs:
27 - name: Unshallowify the repo clone
28 run: git fetch --prune --unshallow
29
30 + # https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
31 - name: Print Go version and environment
32 id: vars
33 run: |
@@ -36,11 +37,17 @@ jobs:
37 go env
38 printf "\n\nSystem environment:\n\n"
39 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\//}"
40 + echo "::set-output name=version_tag::${GITHUB_REF/refs\/tags\//}"
41 + echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
42 + echo "::set-output name=go_cache::$(go env GOCACHE)"
43 +
44 + - name: Cache the build cache
45 + uses: actions/cache@v1
46 + with:
47 + path: ${{ steps.vars.outputs.go_cache }}
48 + key: ${{ runner.os }}-go-release-${{ hashFiles('**/go.sum') }}
49 + restore-keys: |
50 + ${{ runner.os }}-go-release
51
52 # GoReleaser will take care of publishing those artifacts into the release
53 - name: Run GoReleaser
@@ -50,4 +57,12 @@ jobs:
57 args: release --rm-dist
58 env:
59 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53 - TAG: ${{ steps.get_version.outputs.version_tag }}
60 + TAG: ${{ steps.vars.outputs.version_tag }}
61 +
62 + - name: Publish .deb to Gemfury
63 + env:
64 + GEMFURY_PUSH_TOKEN: ${{ secrets.GEMFURY_PUSH_TOKEN }}
65 + run: |
66 + for filename in dist/*.deb; do
67 + curl -F package=@"$filename" https://${GEMFURY_PUSH_TOKEN}:@push.fury.io/caddy/
68 + done
\ No newline at end of file
.goreleaser.yml
+34 -1
@@ -3,12 +3,13 @@ before:
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
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 +
13 builds:
14 - env:
15 - CGO_ENABLED=0
@@ -35,6 +36,7 @@ builds:
36 - -trimpath
37 ldflags:
38 - -s -w
39 +
40 archives:
41 - format_overrides:
42 - goos: windows
@@ -43,12 +45,43 @@ archives:
45 darwin: mac
46 checksum:
47 algorithm: sha512
48 +
49 +nfpms:
50 + - id: default
51 + package_name: caddy
52 +
53 + vendor: Light Code Labs
54 + homepage: https://caddyserver.com
55 + maintainer: Matthew Holt <mholt@users.noreply.github.com>
56 + description: |
57 + Powerful, enterprise-ready, open source web server with automatic HTTPS written in Go
58 + license: Apache 2.0
59 +
60 + formats:
61 + - deb
62 + # - rpm
63 +
64 + bindir: /usr/bin
65 + files:
66 + ./caddy-dist/init/caddy.service: /lib/systemd/system/caddy.service
67 + ./caddy-dist/init/caddy-api.service: /lib/systemd/system/caddy-api.service
68 + ./caddy-dist/welcome/index.html: /usr/share/caddy/index.html
69 + config_files:
70 + ./caddy-dist/config/Caddyfile: /etc/caddy/Caddyfile
71 +
72 + scripts:
73 + postinstall: ./caddy-dist/scripts/postinstall.sh
74 + preremove: ./caddy-dist/scripts/preremove.sh
75 + postremove: ./caddy-dist/scripts/postremove.sh
76 +
77 +
78 release:
79 github:
80 owner: caddyserver
81 name: caddy
82 draft: true
83 prerelease: auto
84 +
85 changelog:
86 sort: asc
87 filters: