-
Notifications
You must be signed in to change notification settings - Fork 27
62 lines (55 loc) · 1.83 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
name: caddy
on:
workflow_dispatch:
schedule:
- cron: '0 16 1,15 * *'
jobs:
build:
strategy:
matrix:
plugin: [cloudflare,alidns,azure,dnspod,googleclouddns,duckdns]
runs-on: ubuntu-latest
steps:
- name: Check Out
uses: actions/checkout@v3
- name: Setup timezone
uses: zcong1993/setup-timezone@master
with:
timezone: Asia/Shanghai
- name: ready
run: |
cp ./caddy/Dockerfile ./Dockerfile
sed -i "s/\${plugin}/${{ matrix.plugin }}/" ./Dockerfile
# docker login
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
# 设置 docker buildx 环境
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
# build 前置操作
- name: Docker before
id: docker_before
run: |
image="${{ secrets.DOCKER_HUB_USERNAME }}/caddy-dns"
tags="$image:${{matrix.plugin}}_$(date +'%y-%m-%d_%H-%M'),$image:${{matrix.plugin}}"
echo "target images $tags"
echo "tags=$tags" >> $GITHUB_OUTPUT
# 一个特殊镜像,修复某些buildx 的 bug
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes > /dev/null 2>&1
# build 并且 push docker 镜像
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: ${{steps.docker_before.outputs.tags}}
platforms: linux/amd64,linux/arm64/v8
# 打印 docker 镜像 SHA256 Hash 值
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}