This repository has been archived by the owner on Apr 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
154 lines (146 loc) · 5.37 KB
/
wxweb_docker_build.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
name: Docker wxweb Build
on:
workflow_dispatch:
watch:
types: [started]
jobs:
md:
name: Docker md Build
runs-on: ubuntu-latest
steps:
-
name: Private Actions Checkout
uses: actions/[email protected]
-
name: Docker Setup QEMU
uses: docker/[email protected]
-
name: Docker Setup Buildx
uses: docker/[email protected]
-
name: Docker Login
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: xrsec
password: ${{ secrets.TOKEN_GITHUB }}
# -
# name: Wget zip
# run: |
# curl -sLm 10 -o md.tar.gz $(jq -r .tarball_url <(curl -sLm 10 https://api.github.com/repos/doocs/md/releases/latest -H "Authorization: token ${{ SECRETS.TOKEN_GITHUB }}"))
-
name: Build and push Docker images
uses: docker/[email protected]
with:
context: .
file: Dockerfiles/md
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/wxweb:md
${{ secrets.DOCKERHUB_USERNAME }}/wxweb:latest
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/wxweb:md
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/wxweb:latest
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/wxweb:md.cache
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/wxweb:md.cache,mode=max
online-markdown:
name: Docker online-markdown Build
runs-on: ubuntu-latest
steps:
-
name: Private Actions Checkout
uses: actions/[email protected]
-
name: Docker Setup QEMU
uses: docker/[email protected]
-
name: Docker Setup Buildx
uses: docker/[email protected]
-
name: Docker Login
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: xrsec
password: ${{ secrets.TOKEN_GITHUB }}
-
name: Build and push Docker images
uses: docker/[email protected]
with:
context: .
file: Dockerfiles/online-markdown
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/wxweb:online-markdown
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/wxweb:online-markdown
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/wxweb:online-markdown.cache
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/wxweb:online-markdown.cache,mode=max
Repository_Dispatch:
needs: [md,online-markdown]
runs-on: ubuntu-latest
steps:
-
name: Private Actions Checkout
uses: actions/[email protected]
-
name: Docker Hub Description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ secrets.DOCKERHUB_USERNAME }}/wxweb
-
name: Get Data
id: getDingData
run: |
set -ex
# 输出仓库名
REPOSITORY="${{GITHUB.REPOSITORY}}"
echo "REPOSITORY=${REPOSITORY#*/}" >> $GITHUB_OUTPUT
# 获取用户仓库信息
# RESPONSE="$(curl -sLm 10 https://api.github.com/repos/${{ GITHUB.REPOSITORY }})"
# 建议填写自己的 TOKEN
RESPONSE="$(curl -sLm 10 https://api.github.com/repos/${{ GITHUB.REPOSITORY }} -H "Authorization: token ${{ SECRETS.TOKEN_GITHUB }}")"
# 获取 用户仓库 设置的 描述,如果为空,可能是没有使用 TOKEN
DESCRIPTION="$(jq -r .description <(echo ${RESPONSE}))"
echo "DESCRIPTION=${DESCRIPTION}" >> $GITHUB_OUTPUT
# 获取 用户仓库 设置的 URL, 如果没有就输出 Github 地址
URL="$(jq -r .homepage <(echo ${RESPONSE}))"
if [[ "${URL}" == "null" || "${URL}" == "" ]]; then
echo "URL=${{ GITHUB.SERVER_URL }}/${{ GITHUB.REPOSITORY }}" >> $GITHUB_OUTPUT
else
echo "URL=${URL}" >> $GITHUB_OUTPUT
fi
-
name: Send dingding notify
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ SECRETS.DING_TOKEN }}
secret: ${{ SECRETS.DING_SECRET }}
body: |
{
"msgtype": "link",
"link": {
"text": "${{ steps.getDingData.outputs.DESCRIPTION }}",
"title": "${{ steps.getDingData.outputs.REPOSITORY }} WorkFlow ${{ GITHUB.JOB }} Success!",
"picUrl": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
"messageUrl": "${{ steps.getDingData.outputs.URL }}"
}
}
-
name: webhook
run: |
curl -s ${{ SECRETS.WebHock }}