1
+ name : Build Push Web Image To Aliyun
2
+
3
+ on :
4
+ workflow_dispatch :
5
+
6
+ env :
7
+ dockerhub_domain : " registry.cn-shenzhen.aliyuncs.com"
8
+ namespace : investoday_x
9
+ context : ./web
10
+ image_name : dify-web-base
11
+ image_tag : " latest"
12
+ image_url : ${dockerhub_domain}/${namespace}/${image_name}:${image_tag}
13
+ dockerhub_user : ${{ secrets.ALIYUN_DOCKER_USERNAME }}
14
+ dockerhub_token : ${{ secrets.ALIYUN_DOCKER_PASSWORD }}
15
+ qywechat_webhook_token : ${{ vars.QYWECHAT_WEBHOOK_TOKEN}}
16
+
17
+ jobs :
18
+ build-and-push :
19
+ runs-on : ubuntu-latest
20
+ steps :
21
+ - name : Checkout Code
22
+ uses : actions/checkout@v2
23
+
24
+ - name : Set up Docker Buildx
25
+ uses : docker/setup-buildx-action@v1
26
+
27
+ - name : Build Image
28
+ run : docker build -t ${{env.image_url}} ./${{env.context}}/.
29
+
30
+ # 登录dockerhub
31
+ - name : Login to DockerHub
32
+ uses : docker/login-action@v3
33
+ with :
34
+ registry : ${{ env.dockerhub_domain }}
35
+ username : ${{ env.dockerhub_user }}
36
+ password : ${{ env.dockerhub_token }}
37
+
38
+ - name : Docker push
39
+ run : docker push ${{ env.image_url }}
40
+
41
+ - name : Get pre step result output image_pull_url
42
+ run : echo "The time was ${{ steps.buildAndPushImage.outputs.image_pull_url }}"
43
+
44
+ - name : Send Webhook
45
+ uses : fjogeleit/http-request-action@v1
46
+ with :
47
+ url : ' https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${{ env.qywechat_webhook_token }}'
48
+ method : ' POST'
49
+ customHeaders : ' {"Content-Type": "application/json"}'
50
+ data : ' { "msgtype": "text", "text": { "content": "[GitHub Actions] ${{env.image_name}}:${{env.image_tag}} 构建推送成功,可后续操作。如Jenkins构建等。"} }'
0 commit comments