Skip to content

Commit 533128e

Browse files
authored
Change cron schedule to 00:00 on the 1st of each month
Updated the cron schedule for monthly builds. 每月1号0点构建镜像 (utc+8)
1 parent 1010254 commit 533128e

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/docker-build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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

0 commit comments

Comments
 (0)