-
Notifications
You must be signed in to change notification settings - Fork 6
229 lines (214 loc) · 8.42 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
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
name: mo-dump release
on:
release:
types: [published]
env:
branch: main
jobs:
linux-amd64-build-job:
runs-on: ubuntu-20.04
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_ACTION }}
- name: Echo some info
run: |
echo ${{ steps.get_release.outputs.upload_url }}
echo ${{ steps.get_release.outputs.tag_name }}
- name: Use Golang
uses: actions/setup-go@v4
with:
go-version: "1.20.11"
cache: false
- name: Build normal
run: |
make build
mkdir -p mo-dump-${{ steps.get_release.outputs.tag_name }}-linux-x86_64
mv mo-dump mo-dump-${{ steps.get_release.outputs.tag_name }}-linux-x86_64/
zip -r mo-dump-${{ steps.get_release.outputs.tag_name }}-linux-x86_64.zip mo-dump-${{ steps.get_release.outputs.tag_name }}-linux-x86_64
- name: Upload Release normal linux x86_64
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_ACTION }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./mo-dump-${{ steps.get_release.outputs.tag_name }}-linux-x86_64.zip
asset_name: mo-dump-${{ steps.get_release.outputs.tag_name }}-linux-x86_64.zip
asset_content_type: application/zip
linux-arm64-build-job:
runs-on: aws-arm64-runner
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_ACTION }}
- name: Echo some info
run: |
echo ${{ steps.get_release.outputs.upload_url }}
echo ${{ steps.get_release.outputs.tag_name }}
- name: Use Golang
uses: actions/setup-go@v4
with:
go-version: "1.20.11"
cache: false
- name: Build normal
run: |
make build
mkdir -p mo-dump-${{ steps.get_release.outputs.tag_name }}-linux-arm64/
mv mo-dump mo-dump-${{ steps.get_release.outputs.tag_name }}-linux-arm64/
zip -r mo-dump-${{ steps.get_release.outputs.tag_name }}-linux-arm64.zip mo-dump-${{ steps.get_release.outputs.tag_name }}-linux-arm64
- name: Upload Release normal linux arm64
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_ACTION }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./mo-dump-${{ steps.get_release.outputs.tag_name }}-linux-arm64.zip
asset_name: mo-dump-${{ steps.get_release.outputs.tag_name }}-linux-arm64.zip
asset_content_type: application/zip
darwin-x86-build-job:
runs-on: macos-latest
steps:
# GitHub Hosted MacOS runner cannot connect to time.apple.com, so use time.windows.com
- name: Sync System Time
run: |
set +e;
for i in {1..10}; do
sudo sntp -sS time.windows.com;
if [ "$?" == "0" ]; then
exit 0;
fi
done
exit 1;
- name: Checkout source
uses: actions/checkout@v3
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_ACTION }}
- name: Use Golang
uses: actions/setup-go@v4
with:
go-version: "1.20.11"
cache: false
- name: Build normal
run: |
make build
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v1
with:
# The certificates in a PKCS12 file encoded as a base64 string
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
# The password used to import the PKCS12 file.
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
- name: Clone gon
uses: actions/checkout@v3
with:
fetch-depth: '1'
repository: matrixorigin/gon
ref: master
path: ./gon
- name: Build gon
run: |
cd $GITHUB_WORKSPACE/gon;
make;
chmod +x gon;
echo "$(pwd)" >> $GITHUB_PATH;
- name: Code signing and app notarization
env:
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
AC_PROVIDER: ${{ secrets.AC_PROVIDER }}
run: |
cd $GITHUB_WORKSPACE
# sign mo-service
gon -log-json ./gon.json
unzip -d ./mo-dump-darwin mo-dump.zip
cd ./mo-dump-darwin
spctl -a -vvv -t install mo-dump
codesign --test-requirement="=notarized" -vv mo-dump
# rename filepath
cd .. && mv ./mo-dump-darwin mo-dump-${{ steps.get_release.outputs.tag_name }}-darwin-x86_64
zip -r mo-dump-${{ steps.get_release.outputs.tag_name }}-darwin-x86_64.zip mo-dump-${{ steps.get_release.outputs.tag_name }}-darwin-x86_64
- name: Upload Release normal darwin x86_64
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_ACTION }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./mo-dump-${{ steps.get_release.outputs.tag_name }}-darwin-x86_64.zip
asset_name: mo-dump-${{ steps.get_release.outputs.tag_name }}-darwin-x86_64.zip
asset_content_type: application/zip
#if the release for darwin-arm is failed, please contact guguducken to check runner status
darwin-arm-build-job:
runs-on: mac-arm64-mini
steps:
- name: Sync system time
run: |
set +e;
for i in {1..10}; do
sudo sntp -sS time.apple.com;
if [ "$?" == "0" ]; then
exit 0;
fi
done
exit 1;
- name: Checkout source
uses: actions/checkout@v3
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_ACTION }}
- name: Check go version
run: |
go version
- name: Build normal
run: |
make build
- name: Remove Code-Signing Certificates
run: |
security list-keychains | grep sign | awk 'system("security delete-keychain "$1)'
security find-identity -p codesigning | grep ID | awk 'NR=1{system("security delete-identity -Z "$2)}'
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v1
with:
# The certificates in a PKCS12 file encoded as a base64 string
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
# The password used to import the PKCS12 file.
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
- name: Code signing and app notarization
env:
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
AC_PROVIDER: ${{ secrets.AC_PROVIDER }}
run: |
cat ./gon.json
gon -log-json ./gon.json
unzip -d ./mo-dump-darwin mo-dump.zip
cd ./mo-dump-darwin
spctl -a -vvv -t install mo-dump
codesign --test-requirement="=notarized" -vv mo-dump
# rename filepath
cd .. && mv ./mo-dump-darwin mo-dump-${{ steps.get_release.outputs.tag_name }}-darwin-arm64
zip -r mo-dump-${{ steps.get_release.outputs.tag_name }}-darwin-arm64.zip mo-dump-${{ steps.get_release.outputs.tag_name }}-darwin-arm64
- name: Upload Release normal darwin arm64
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_ACTION }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./mo-dump-${{ steps.get_release.outputs.tag_name }}-darwin-arm64.zip
asset_name: mo-dump-${{ steps.get_release.outputs.tag_name }}-darwin-arm64.zip
asset_content_type: application/zip
- name: Remove Code-Signing Certificates
if: ${{ always() }}
run: |
security list-keychains | grep sign | awk 'system("security delete-keychain "$1)'
security find-identity -p codesigning | grep ID | awk 'NR=1{system("security delete-identity -Z "$2)}'