GitHub Actions 借助 acme.sh 结合阿里云 DNS 生成多域名的通配符证书

GitHub Actions 借助 acme.sh 结合阿里云 DNS 生成多域名的通配符证书

acme.sh 的最新版有问题,目前只能使用 3.0.5 版本,详见: https://github.com/acmesh-official/acme.sh/issues/4621

.github/workflows/ssl_for_aliyun.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
name: Generate SSL

on:
push:
branches:
- main

jobs:
ssl:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ALIYUN_KEY: LTAI5tN2UwSUNpxaLodnDd8g
ALIYUN_SECRET: 5Rx17mer3lfxYfvgjPzy0eYW68ycVI
EMAIL: hong@hongfs.cn
steps:
- uses: actions/checkout@v3
- uses: szenius/set-timezone@v1.2
with:
timezoneLinux: Asia/Shanghai
- name: RUN
run: |
cd $GITHUB_WORKSPACE
mkdir -p ssl
podman run \
-v ./ssl/:/ssl/ \
-e Ali_Key=$ALIYUN_KEY \
-e Ali_Secret=$ALIYUN_SECRET \
-e MAX_RETRY_TIMES=100 \
--user 0:0 \
--rm \
ghcr.io/hongfs/env:acme.sh \
--issue \
--server zerossl \
--dnssleep 0 \
--listen-v4 \
--email $EMAIL \
--key-file "/ssl/ssl.key" \
--fullchain-file "/ssl/ssl.pem" \
--dns dns_ali \
-d "*.hongfs.cn" \
-d "*.dev.hongfs.cn" \
-d "*.hongfs.dev" \
--force

TIME=$(date +%Y%m%d%H%M%S)

echo "TIME=$TIME" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
with:
name: SSL_${{ env.TIME }}
path: |
ssl/ssl.pem
ssl/ssl.key
retention-days: 90
往上