Skip to content

Commit 24bf075

Browse files
committed
feat(workflow): 添加手动触发的Docker基础镜像发布工作流
- 新增GitHub Actions工作流文件 manual_base_image.yaml- 支持手动输入版本号触发构建 - 配置Docker Buildx环境 - 登录DockerHub和阿里云镜像仓库 - 构建并推送logstash、logrotate和Redis镜像 - 添加构建开始和完成的通知 webhook 调用 - 设置镜像标签包括版本号和latest - 支持多平台构建 (linux/amd64)
1 parent a0c5ddc commit 24bf075

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Release DongTai IAST Base Image (Manual)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag_name:
7+
description: "请输入要构建的版本号(例如 v1.17.7)"
8+
required: true
9+
default: "v1.0.0"
10+
11+
jobs:
12+
Release-DongTai-Infra-Service:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
max-parallel: 4
16+
steps:
17+
- name: start-build
18+
uses: joelwmale/webhook-action@master
19+
with:
20+
url: ${{ secrets.WEBHOOK_URL }}
21+
body: '{"msg_type": "interactive","card": {"config": {"wide_screen_mode": true,"enable_forward": true},"elements": [{"tag": "div","text": {"content": "状态:构建开始\n项目:${{github.repository}}\n分支:${{github.ref}}\n流程:${{github.workflow}}\n构建编号:${{github.run_number}}\n触发事件:${{github.event_name}}\n提交人:${{github.actor}}\n手动输入版本:${{ github.event.inputs.tag_name }}\n","tag": "lark_md"}}]}}'
22+
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v2
28+
29+
- name: Login to DockerHub
30+
uses: docker/login-action@v1
31+
with:
32+
username: ${{ secrets.DONGTAI_DOCKERHUB_USERNAME }}
33+
password: ${{ secrets.DONGTAI_DOCKERHUB_TOKEN }}
34+
35+
- name: Login to AliyunRegistry
36+
uses: docker/login-action@v1
37+
with:
38+
registry: ${{ secrets.ALIYUN_REGISTRY }}
39+
username: ${{ secrets.ALIYUN_DOCKERHUB_USER }}
40+
password: ${{ secrets.ALIYUN_DOCKERHUB_PASSWORD }}
41+
42+
- id: release
43+
run: |
44+
TAG_NAME=${{ github.event.inputs.tag_name }}
45+
ID=$(echo ${TAG_NAME##v})
46+
echo "version=$ID" >> $GITHUB_OUTPUT
47+
48+
- name: Build and push logstash
49+
uses: docker/build-push-action@v3
50+
with:
51+
context: ./logstash
52+
file: ./logstash/Dockerfile
53+
push: true
54+
platforms: linux/amd64
55+
tags: |
56+
dongtai/dongtai-logstash:${{ steps.release.outputs.version }}
57+
dongtai/dongtai-logstash:latest
58+
59+
- name: Build and push logrotate
60+
uses: docker/build-push-action@v3
61+
with:
62+
context: ./logrotate
63+
file: ./logrotate/Dockerfile
64+
push: true
65+
platforms: linux/amd64
66+
tags: |
67+
dongtai/dongtai-logrotate:${{ steps.release.outputs.version }}
68+
dongtai/dongtai-logrotate:latest
69+
70+
- name: Build and push Redis
71+
uses: docker/build-push-action@v3
72+
with:
73+
context: ./redis
74+
push: true
75+
platforms: linux/amd64
76+
tags: |
77+
dongtai/dongtai-redis:${{ steps.release.outputs.version }}
78+
dongtai/dongtai-redis:latest
79+
80+
- name: finish build
81+
uses: joelwmale/webhook-action@master
82+
with:
83+
url: ${{ secrets.WEBHOOK_URL }}
84+
body: '{"msg_type": "interactive","card": {"config": {"wide_screen_mode": true,"enable_forward": true},"elements": [{"tag": "div","text": {"content": "状态:构建完成\n项目:${{github.repository}}\n分支:${{github.ref}}\n流程:${{github.workflow}}\n构建编号:${{github.run_number}}\n触发事件:${{github.event_name}}\n提交人:${{github.actor}}\n版本:${{ github.event.inputs.tag_name }}\n","tag": "lark_md"}}]}}'

0 commit comments

Comments
 (0)