-
Notifications
You must be signed in to change notification settings - Fork 431
159 lines (145 loc) · 4.34 KB
/
caddy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Build caddy
on:
workflow_dispatch:
release:
types:
- 'prereleased'
- 'published'
- 'released'
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config:
- {
name: "windows-386",
GOARCH: 386,
GOOS: windows,
release: true
}
- {
name: "windows-amd64",
GOARCH: amd64,
GOOS: windows,
release: true
}
- {
name: "linux-amd64",
GOARCH: amd64,
GOOS: linux,
release: true
}
- {
name: "linux-arm64",
GOARCH: arm64,
GOOS: linux,
release: true
}
- {
name: "linux-armv5",
GOARCH: arm,
GOARM: 5,
GOOS: linux,
release: true
}
- {
name: "linux-s390x",
GOARCH: s390x,
GOOS: linux,
release: true
}
- {
name: "freebsd-amd64",
GOARCH: amd64,
GOOS: freebsd,
release: true
}
- {
name: "freebsd-arm64",
GOARCH: arm64,
GOOS: linux,
release: true
}
- {
name: "darwin-amd64",
GOARCH: amd64,
GOOS: darwin,
release: true
}
- {
name: "darwin-arm64",
GOARCH: arm64,
GOOS: darwin,
release: true
}
steps:
- name: Checkout
uses: actions/checkout@v4
- 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
- name: Build caddy
run: |
mkdir release-tmp
export GOARCH=${{ matrix.config.GOARCH }}
export GOOS=${{ matrix.config.GOOS }}
~/go/bin/xcaddy build master \
--with github.com/mholt/caddy-l4 \
--with github.com/caddy-dns/cloudflare \
--with clevergo.tech/caddy-dnspodcn \
--with github.com/caddy-dns/duckdns \
--with github.com/mholt/caddy-dynamicdns \
--with github.com/mholt/caddy-events-exec \
--with github.com/WeidiDeng/caddy-cloudflare-ip \
--with github.com/xcaddyplugins/caddy-trusted-cloudfront \
--with github.com/caddyserver/forwardproxy=github.com/klzgrad/forwardproxy@naive \
--with github.com/imgk/caddy-trojan \
--with github.com/mholt/caddy-webdav \
--output ./release-tmp/caddy
- name: Rename for Windows
if: matrix.config.GOOS == 'windows'
run: |
mv ./release-tmp/caddy ./release-tmp/caddy.exe
- name: Calculate Hash
run: |
cd ./release-tmp || exit 1
sha256sum * > sha256
- name: Generate zip for Windows
if: matrix.config.GOOS == 'windows'
run: |
mkdir release-ready
cd ./release-tmp
zip -r ../release-ready/caddy-${{ matrix.config.name }}.zip *
- name: Generate tar for other platform
if: matrix.config.GOOS != 'windows'
run: |
mkdir release-ready
cd ./release-tmp
tar -zcvf ../release-ready/caddy-${{ matrix.config.name }}.tar.gz *
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
name: caddy-${{ github.sha }}-${{ matrix.config.name }}
path: ./release-ready/*
- name: Upload to GitHub Release for Windows
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release' && matrix.config.release && matrix.config.GOOS == 'windows'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./release-ready/caddy-${{ matrix.config.name }}.zip
tag: ${{ github.ref }}
overwrite: true
- name: Upload to GitHub Release for other platform
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release' && matrix.config.release && matrix.config.GOOS != 'windows'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./release-ready/caddy-${{ matrix.config.name }}.tar.gz
tag: ${{ github.ref }}
overwrite: true