-
Notifications
You must be signed in to change notification settings - Fork 88
231 lines (210 loc) · 8.05 KB
/
release.yaml
File metadata and controls
231 lines (210 loc) · 8.05 KB
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Dubbo Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Check if Release Exists
id: check
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const tag = context.ref.replace('refs/tags/', '');
try {
await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag,
});
return "exists";
} catch (e) {
if (e.status === 404) return "not_found";
throw e;
}
- name: Create GitHub Release
id: create_release
if: steps.check.outputs.result == 'not_found'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: "${{ github.ref_name }}"
body: |
Fix the problem that dubbo-cp service traffic has no corresponding endpoint.
draft: false
prerelease: false
build_and_upload:
name: Build and Upload Binaries
needs: create_release
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, darwin, windows]
goarch: [386, amd64, arm64]
exclude:
- goos: darwin
goarch: 386
- goos: windows
goarch: arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Download dependencies
run: go mod download
- name: Dubboctl Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GIT_VERSION: ${{ github.ref_name }}
run: |
mkdir -p build/dubboctl
make build-dubboctl GOOS=${GOOS} GOARCH=${GOARCH} GIT_VERSION=${GIT_VERSION}
cp README.md LICENSE build/dubboctl/
mv bin/dubboctl* build/dubboctl/
ls -ln build/dubboctl/
- name: Dubbo-CP Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GIT_VERSION: ${{ github.ref_name }}
run: |
mkdir -p build/dubbo-cp
make build-dubbo-cp GOOS=${GOOS} GOARCH=${GOARCH} GIT_VERSION=${GIT_VERSION}
cp README.md LICENSE build/dubbo-cp/
mv bin/dubbo-cp* build/dubbo-cp/
ls -ln build/dubbo-cp/
- name: Dubbo Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GIT_VERSION: ${{ github.ref_name }}
run: |
mkdir -p build/dubbo-cp
mkdir -p build/dubboctl
make build-dubbo-cp GOOS=${GOOS} GOARCH=${GOARCH} GIT_VERSION=${GIT_VERSION}
make build-dubboctl GOOS=${GOOS} GOARCH=${GOARCH} GIT_VERSION=${GIT_VERSION}
make clone-sample GOOS=${GOOS} GOARCH=${GOARCH} GIT_VERSION=${GIT_VERSION}
cp README.md LICENSE build/
mv bin/dubbo-cp* build/dubbo-cp/
mv bin/dubboctl* build/dubboctl/
mv bin/samples/ build/
ls -ln build/dubboctl/ ; ls -ln build/dubbo-cp/ ; ls -ln build/
- name: Dubboctl Rename windows
if: matrix.goos == 'windows'
run: |
cp build/dubboctl/dubboctl build/dubboctl/dubboctl.exe
- name: Dubbo-CP Rename windows
if: matrix.goos == 'windows'
run: |
cp build/dubbo-cp/dubbo-cp build/dubbo-cp/dubbo-cp.exe
- name: dubboctl Package files
id: package_ctl
run: |
VERSION=${GITHUB_REF#refs/tags/}
FILENAME=dubboctl-${VERSION}-${{ matrix.goos }}-${{ matrix.goarch }}
DIRNAME=dubboctl-${VERSION}
mkdir -p ${DIRNAME}/bin
cp build/dubboctl/dubboctl ${DIRNAME}/bin
ls -ln ${DIRNAME}/bin
cp build/dubboctl/README.md build/dubboctl/LICENSE ${DIRNAME}
ls -Rlh ${DIRNAME}
if [ "${{ matrix.goos }}" = "windows" ]; then
zip -r ${FILENAME}.zip ${DIRNAME}/bin
echo "name=${FILENAME}.zip" >> $GITHUB_OUTPUT
else
tar -czvf ${FILENAME}.tar.gz ${DIRNAME}
echo "name=${FILENAME}.tar.gz" >> $GITHUB_OUTPUT
fi
- name: dubbo-cp Package files
id: package_cp
run: |
VERSION=${GITHUB_REF#refs/tags/}
FILENAME=dubbo-cp-${VERSION}-${{ matrix.goos }}-${{ matrix.goarch }}
DIRNAME=dubbo-cp-${VERSION}
mkdir -p ${DIRNAME}/bin
cp build/dubbo-cp/dubbo-cp ${DIRNAME}/bin
ls -ln ${DIRNAME}/bin
cp build/dubbo-cp/README.md build/dubbo-cp/LICENSE build/dubbo-cp/dubbo-cp.yaml ${DIRNAME}
ls -Rlh ${DIRNAME}
if [ "${{ matrix.goos }}" = "windows" ]; then
zip -r ${FILENAME}.zip dubbo-cp-${VERSION}
echo "name=${FILENAME}.zip" >> $GITHUB_OUTPUT
else
tar -czvf ${FILENAME}.tar.gz ${DIRNAME}
echo "name=${FILENAME}.tar.gz" >> $GITHUB_OUTPUT
fi
- name: dubbo Package files
id: package_dubbo
run: |
VERSION=${GITHUB_REF#refs/tags/}
FILENAME=dubbo-${VERSION}-${{ matrix.goos }}-${{ matrix.goarch }}
DIRNAME=dubbo-${VERSION}
mkdir -p ${DIRNAME}/bin
cp build/dubboctl/dubboctl ${DIRNAME}/bin/
cp build/dubbo-cp/dubbo-cp ${DIRNAME}/bin/
cp build/README.md build/LICENSE ${DIRNAME}
cp build/dubbo-cp/dubbo-cp.yaml ${DIRNAME}
cp -r build/samples ${DIRNAME}
ls -Rlh ${DIRNAME}
if [ "${{ matrix.goos }}" = "windows" ]; then
zip -r ${FILENAME}.zip ${DIRNAME}
echo "name=${FILENAME}.zip" >> $GITHUB_OUTPUT
else
tar -czvf ${FILENAME}.tar.gz ${DIRNAME}
echo "name=${FILENAME}.tar.gz" >> $GITHUB_OUTPUT
fi
- name: Upload Dubboctl Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ steps.package_ctl.outputs.name }}
asset_name: ${{ steps.package_ctl.outputs.name }}
asset_content_type: application/octet-stream
- name: Upload Dubbo-CP Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ steps.package_cp.outputs.name }}
asset_name: ${{ steps.package_cp.outputs.name }}
asset_content_type: application/octet-stream
- name: Upload Dubbo Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ steps.package_dubbo.outputs.name }}
asset_name: ${{ steps.package_dubbo.outputs.name }}
asset_content_type: application/octet-stream