-
Notifications
You must be signed in to change notification settings - Fork 30
392 lines (352 loc) · 14.3 KB
/
Copy pathrelease.yaml
File metadata and controls
392 lines (352 loc) · 14.3 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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
name: Release Flow
on:
release:
types: [prereleased, released]
permissions:
contents: read
jobs:
publish-packages:
name: Push Packages
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: maus007/docker-run-action-fork@v1
with:
image: valory/open-autonomy-user:0.21.26
options: -v ${{ github.workspace }}:/work
shell: bash
run: |
echo "Pushing Packages"
cd /work
export AUTHOR=$(grep 'service' packages/packages.json | awk -F/ '{print $2}' | head -1)
autonomy init --reset --author $AUTHOR --ipfs --remote
autonomy push-all
publish-images:
name: Publish Docker Images (amd64)
runs-on: ubuntu-24.04
needs:
- "publish-packages"
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v3
- name: Set up tag and vars
run: |
echo "Setting Tag Images"
TAG=$(git describe --exact-match --tags $(git rev-parse HEAD)) || { echo "You are not on a tagged branch"; exit 1; }
TAG=$(echo $TAG | sed 's/^v//')
echo VERSION=$TAG > env.sh
echo AUTHOR=$(grep 'service/' packages/packages.json | awk -F/ '{print $2}' | head -1) >> env.sh
echo SERVICE=$(grep 'service/' packages/packages.json | awk -F/ '{print $3}' | head -1) >> env.sh
echo AGENT=$(grep 'agent/' packages/packages.json | awk -F/ '{print $3}' | head -1) >> env.sh
echo DEFAULT_IMAGE_TAG=$(cat packages/packages.json | grep agent/ | awk -F: '{print $2}' | tr -d '", ' | head -n 1) >> env.sh
cat env.sh
- uses: maus007/docker-run-action-fork@v1
name: Build Images
with:
image: valory/open-autonomy-user:0.21.26
options: -v ${{ github.workspace }}:/work -e DOCKER_USER -e DOCKER_PASSWORD
shell: bash
run: |
echo "Building Docker Images"
cd /work
source env.sh || exit 1
echo "Building images for $AUTHOR for service $SERVICE"
autonomy init --reset --author $AUTHOR --ipfs --remote
autonomy fetch $AUTHOR/$SERVICE --service --local || exit 1
cd $SERVICE || exit 1
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin || exit 1
docker buildx create --name multiarch-builder --driver docker-container --bootstrap --use
autonomy build-image --builder multiarch-builder --platform linux/amd64 --pre-install-command "apt update && apt upgrade -y && apt install -y libffi-dev libssl-dev" -e open-autonomy==0.21.26 --version $VERSION-amd64 --push || exit 1
publish-images-arm:
name: Publish Docker Images (arm64 + arm/v7)
runs-on: ubuntu-24.04-arm
needs:
- "publish-packages"
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v3
- name: Set up tag and vars
run: |
echo "Setting Tag Images"
TAG=$(git describe --exact-match --tags $(git rev-parse HEAD)) || { echo "You are not on a tagged branch"; exit 1; }
TAG=$(echo $TAG | sed 's/^v//')
echo VERSION=$TAG > env.sh
echo AUTHOR=$(grep 'service/' packages/packages.json | awk -F/ '{print $2}' | head -1) >> env.sh
echo SERVICE=$(grep 'service/' packages/packages.json | awk -F/ '{print $3}' | head -1) >> env.sh
echo AGENT=$(grep 'agent/' packages/packages.json | awk -F/ '{print $3}' | head -1) >> env.sh
echo DEFAULT_IMAGE_TAG=$(cat packages/packages.json | grep agent/ | awk -F: '{print $2}' | tr -d '", ' | head -n 1) >> env.sh
cat env.sh
- uses: maus007/docker-run-action-fork@v1
name: Build Images
with:
image: valory/open-autonomy-user:0.21.26
options: -v ${{ github.workspace }}:/work -e DOCKER_USER -e DOCKER_PASSWORD
shell: bash
run: |
echo "Building Docker Images"
cd /work
source env.sh || exit 1
echo "Building images for $AUTHOR for service $SERVICE"
autonomy init --reset --author $AUTHOR --ipfs --remote
autonomy fetch $AUTHOR/$SERVICE --service --local || exit 1
cd $SERVICE || exit 1
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin || exit 1
docker buildx create --name multiarch-builder --driver docker-container --bootstrap --use
autonomy build-image --builder multiarch-builder --platform linux/arm64,linux/arm/v7 --pre-install-command "apt update && apt install -y libffi-dev libssl-dev && pip config set global.extra-index-url https://www.piwheels.org/simple" -e open-autonomy==0.21.26 --version $VERSION-arm --push || exit 1
merge-image-manifests:
name: Merge Multi-arch Image Manifests
runs-on: ubuntu-24.04
needs:
- "publish-images"
- "publish-images-arm"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up tag and vars
run: |
echo "Setting Tag Images"
TAG=$(git describe --exact-match --tags $(git rev-parse HEAD)) || { echo "You are not on a tagged branch"; exit 1; }
TAG=$(echo $TAG | sed 's/^v//')
echo VERSION=$TAG > env.sh
echo AUTHOR=$(grep 'service/' packages/packages.json | awk -F/ '{print $2}' | head -1) >> env.sh
echo AGENT=$(grep 'agent/' packages/packages.json | awk -F/ '{print $3}' | head -1) >> env.sh
echo DEFAULT_IMAGE_TAG=$(cat packages/packages.json | grep agent/ | awk -F: '{print $2}' | tr -d '", ' | head -n 1) >> env.sh
cat env.sh
- name: Merge manifests
run: |
source env.sh || exit 1
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin || exit 1
docker buildx imagetools create \
$AUTHOR/oar-$AGENT:$VERSION-amd64 \
$AUTHOR/oar-$AGENT:$VERSION-arm \
--tag $AUTHOR/oar-$AGENT:$VERSION || exit 1
docker buildx imagetools create \
$AUTHOR/oar-$AGENT:$VERSION \
--tag $AUTHOR/oar-$AGENT:$DEFAULT_IMAGE_TAG || exit 1
build-agent-runner:
needs:
- "publish-packages"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2025, macos-15, macos-15-large, ubuntu-24.04, ubuntu-22.04-arm]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
# Set up Python with setup-python action and add it to PATH
- uses: actions/setup-python@v6
id: setup-python
with:
python-version: "3.10"
- name: Add Python to PATH
run: |
echo "${{ steps.setup-python.outputs.python-path }}" >> $GITHUB_PATH
- name: prepare sign things windows
if: runner.os == 'Windows'
run: |
echo Setup Certificate
echo "${{secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
echo "Set Variables!"
echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV"
echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV"
echo "SM_KEY_PAIR_ALIAS=${{ secrets.SM_KEY_PAIR_ALIAS }}" >> "$GITHUB_ENV"
echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV"
echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH
echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH
echo "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" >> $GITHUB_PATH
shell: bash
- name: Setup SSM KSP on windows latest
if: runner.os == 'Windows'
run: |
curl -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o smtools-windows-x64.msi
msiexec /i smtools-windows-x64.msi /quiet /qn
smksp_registrar.exe list
smctl.exe keypair ls
C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user
smksp_cert_sync.exe
shell: cmd
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: prepare agent
run: |
if [[ "$RUNNER_OS" == "macOS" ]]; then
export SDKROOT=$(xcrun --show-sdk-path)
fi
make uv-install
uv run autonomy init --reset --author "dummy_author_git_ci" --ipfs --remote
make hash_id
make agent_id
- name: prepare archives
if: matrix.os == 'ubuntu-24.04'
run: |
make agent.zip
make agent.tar.gz
- name: make key
run: |
make ./agent/ethereum_private_key.txt
## LINUX
- name: Build Agent Runner Linux
if: runner.os == 'Linux'
run: |
make build-agent-runner
- name: rename the file linux
if: runner.os == 'Linux'
run: |
export FILENAME=`echo -n agent_runner_${{runner.os}}_${{runner.arch}}|tr '[:upper:]' '[:lower:]'`
echo "FILENAME=$FILENAME" >> $GITHUB_ENV;
cp dist/agent_runner_bin dist/${FILENAME}
chmod +x dist/${FILENAME}
#### MAC
- name: build an sign sign the file mac os
if: runner.os == 'macOS'
env:
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} # Team ID из Apple Dev Account
SIGN_ID: "Developer ID Application: Valory AG (${{ secrets.APPLE_TEAM_ID }})"
run: |
echo "$CSC_LINK" | base64 --decode > certificate.p12
security create-keychain -p temp build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p temp build.keychain
security import certificate.p12 -k build.keychain -P "$CSC_KEY_PASSWORD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k temp build.keychain
make build-agent-runner-mac
codesign -dv --verbose=4 dist/agent_runner_bin
- name: rename the file mac os
if: runner.os == 'macOS'
run: |
export FILENAME=`echo -n agent_runner_${{runner.os}}_${{runner.arch}}|tr '[:upper:]' '[:lower:]'`
echo "FILENAME=$FILENAME" >> $GITHUB_ENV;
cp dist/agent_runner_bin dist/${FILENAME}
dist/${FILENAME} --version
### WINDOWS
- name: Build Agent Runner Windows
if: runner.os == 'Windows'
run: |
make build-agent-runner
- name: sign the file
if: runner.os == 'Windows'
run: |
"C:\\Program Files\\DigiCert\\DigiCert One Signing Manager Tools\\smctl.exe" sign --keypair-alias=${{ secrets.SM_KEY_PAIR_ALIAS }} --input "dist/agent_runner_bin.exe"
- name: rename the file windows
if: runner.os == 'Windows'
run: |
export FILENAME=`echo -n agent_runner_${{runner.os}}_${{runner.arch}}.exe|tr '[:upper:]' '[:lower:]'`
echo "FILENAME=$FILENAME" >> $GITHUB_ENV;
cp dist/agent_runner_bin.exe dist/${FILENAME}
### PERFORM CHECK OF AGENT RUNNER
- name: check agent runner
run: |
make check-agent-runner
- name: Upload agent runner binary
uses: actions/upload-artifact@v7
with:
name: ${{env.FILENAME}}
path: dist/${{env.FILENAME}}
- name: Upload hash_id
if: matrix.os == 'ubuntu-24.04'
uses: actions/upload-artifact@v7
with:
name: hash_id
path: hash_id
- name: Upload agent_id
if: matrix.os == 'ubuntu-24.04'
uses: actions/upload-artifact@v7
with:
name: agent_id
path: agent_id
- name: Upload agent.tar.gz
if: matrix.os == 'ubuntu-24.04'
uses: actions/upload-artifact@v7
with:
name: agent.tar.gz
path: agent.tar.gz
- name: Upload agent.zip
if: matrix.os == 'ubuntu-24.04'
uses: actions/upload-artifact@v7
with:
name: agent.zip
path: agent.zip
upload-assets:
needs: build-agent-runner
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
# MAC OS
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: agent_runner_macos_x64
path: ./dist/
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: agent_runner_macos_arm64
path: ./dist/
# LINUX
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: agent_runner_linux_x64
path: ./dist/
# LINUX ARM
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: agent_runner_linux_arm64
path: ./dist/
# WINDOWS
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: agent_runner_windows_x64.exe
path: ./dist/
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: agent_id
path: ./dist/
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: hash_id
path: ./dist/
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: agent.zip
path: ./dist/
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: agent.tar.gz
path: ./dist/
- name: List files
run: ls ./dist/
- name: Publish Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./dist/agent_runner*
./dist/hash_id
./dist/agent_id
./dist/agent.zip
./dist/agent.tar.gz