-
Notifications
You must be signed in to change notification settings - Fork 506
162 lines (155 loc) · 5.07 KB
/
release.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
155
156
157
158
159
160
161
162
name: Tag Release
on:
push:
tags:
- "v*"
jobs:
frontend:
name: Build frontend
with:
upload: true
uses: ./.github/workflows/frontend.yml
agent:
name: Build agent
with:
upload: true
uses: ./.github/workflows/agent.yml
backend:
name: Build backend
with:
upload: true
uses: ./.github/workflows/backend.yml
package-zip:
name: Package Zip
runs-on: ubuntu-20.04
needs: [frontend, agent, backend]
steps:
- uses: actions/checkout@v3
- name: download frontend
uses: actions/[email protected]
with:
name: frontend
path: src/frontend/frontend
- name: download agent
uses: actions/[email protected]
with:
name: agent
path: src/agent/agent/bin/
- name: download backend
uses: actions/[email protected]
with:
name: backend-jar
path: src/backend/ci/release
- name: make package
run: |
version="$(basename $GITHUB_REF)"
echo "version=$version" >> $GITHUB_OUTPUT
ci_ms_wip="sign,monitoring" ci_pkg_dir=/dev/shm/ci ./scripts/packager-ci.sh "$version" bkci-slim.tar.gz
- uses: actions/upload-artifact@v4
with:
name: bkci-slim
path: bkci-slim.tar.gz
package-docker:
name: Package Docker
runs-on: ubuntu-20.04
needs: [frontend, agent, backend]
steps:
- uses: actions/checkout@v3
- name: download frontend
uses: actions/[email protected]
with:
name: frontend
path: src/frontend/frontend
- name: download agent
uses: actions/[email protected]
with:
name: agent
path: src/agent/agent/bin/
- name: download bkci
uses: actions/[email protected]
with:
name: backend-docker
path: src/backend/ci/release
- name: make package
run: |
version="$(basename $GITHUB_REF)"
echo "version=$version" >> $GITHUB_OUTPUT
ci_ms_wip="sign" ci_pkg_dir=/dev/shm/ci-docker ./scripts/packager-ci.sh "$version" bkci-docker.tar.gz
- name: Setup Docker -- CLOUD NATIVE
uses: docker-practice/actions-setup-docker@master
- name: Create Docker Image -- CLOUD NATIVE
working-directory: docker-images/core/ci
run: |
version="$(basename $GITHUB_REF)"
docker login --username=${{ secrets.DOCKER_USER }} --password=${{ secrets.DOCKER_PASS }} ${{ secrets.DOCKER_HOST }}
./0.get_release.sh
./1.build_gateway_image.sh ${{ secrets.DOCKER_IMAGE_REGISTRY }} $version
./2.build_backend_bkci_image.sh ${{ secrets.DOCKER_IMAGE_REGISTRY }} $version
./3.build_frontend_image.sh ${{ secrets.DOCKER_IMAGE_REGISTRY }} $version
package-helm:
name: Package Helm
runs-on: ubuntu-20.04
needs: [frontend, agent, backend]
steps:
- uses: actions/checkout@v3
- name: Setup Python -- CLOUD NATIVE
uses: actions/setup-python@v4
with:
python-version: "3.7.15"
- name: Generate Helm Chart -- CLOUD NATIVE
working-directory: helm-charts/core/ci
run: |
version="$(basename $GITHUB_REF)"
echo 'python build'
pip install pyhumps
pip install PyYAML
python build_chart.py ${{ secrets.DOCKER_IMAGE_REGISTRY }} $version $version $version
- name: Install Helm -- CLOUD NATIVE
uses: azure/setup-helm@v3
with:
version: v3.8.1
- name: Package Helm Chart -- CLOUD NATIVE
working-directory: helm-charts/core/ci
run: |
version="$(basename $GITHUB_REF)"
helm package . --version $version --app-version $version
mv bk-ci-$version.tgz bk-ci-charts.tgz
- uses: actions/upload-artifact@v4
with:
name: bkci-chart
path: helm-charts/core/ci/bk-ci-charts.tgz
releaseAll:
name: Release All
runs-on: ubuntu-20.04
needs: [package-zip, package-helm]
steps:
- name: download bkci-slim
uses: actions/[email protected]
with:
name: bkci-slim
path: ./
- name: download bkci-chart
uses: actions/[email protected]
with:
name: bkci-chart
path: ./
- name: get change log file
id: get_version_file
run: |
version=${{ github.ref_name }}
version=$(echo ${version:1})
version=`echo $version | sed 's/-/./g'`
major=`echo $version | cut -d. -f1`
minor=`echo $version | cut -d. -f2`
echo "version_file=CHANGELOG/CHANGELOG-$major.$minor.md"
echo "version_file=CHANGELOG/CHANGELOG-$major.$minor.md" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: ncipollo/[email protected]
with:
name: "bk-ci ${{ github.ref_name }}"
draft: true
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
body: "See <a href='https://github.com/TencentBlueKing/bk-ci/blob/master/${{steps.get_version_file.outputs.version_file}}'>the CHANGELOG</a> for more details."
artifacts: "bkci-slim.tar.gz,bk-ci-charts.tgz"