File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build Caddy Cloudflare Latest
2+
3+ on :
4+ push :
5+ branches : ["main"]
6+ schedule :
7+ - cron : ' 0 16 1 * *' # 每月1号自动构建一次,确保镜像保持最新
8+ workflow_dispatch : # 允许手动点击按钮触发构建
9+
10+ env :
11+ REGISTRY : ghcr.io
12+ IMAGE_NAME : ${{ github.repository }}
13+
14+ jobs :
15+ build :
16+ runs-on : ubuntu-latest
17+ permissions :
18+ contents : read
19+ packages : write
20+
21+ steps :
22+ - name : Checkout
23+ uses : actions/checkout@v4
24+
25+ - name : Set up QEMU
26+ uses : docker/setup-qemu-action@v3
27+
28+ - name : Set up Docker Buildx
29+ uses : docker/setup-buildx-action@v3
30+
31+ - name : Log in to GHCR
32+ uses : docker/login-action@v3
33+ with :
34+ registry : ${{ env.REGISTRY }}
35+ username : ${{ github.actor }}
36+ password : ${{ secrets.GITHUB_TOKEN }}
37+
38+ - name : Build and push
39+ uses : docker/build-push-action@v5
40+ with :
41+ context : .
42+ push : true
43+ # 自动编译兼容普通服务器(amd64)和ARM服务器(arm64)
44+ platforms : linux/amd64,linux/arm64
45+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
46+ cache-from : type=gha
47+ cache-to : type=gha,mode=max
You can’t perform that action at this time.
0 commit comments