-
Notifications
You must be signed in to change notification settings - Fork 0
398 lines (352 loc) · 12.8 KB
/
deploy.yml
File metadata and controls
398 lines (352 loc) · 12.8 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
393
394
395
396
397
398
name: Release and Deploy
on:
push:
tags:
- 'v*'
jobs:
check-secrets:
name: Check Secrets
runs-on: ubuntu-latest
steps:
- name: Verify required secrets and variables
run: |
MISSING_SECRETS=()
# Check repository variables
if [ -z "$APP_ID" ]; then
MISSING_SECRETS+=("APP_ID (repository variable)")
fi
# Check repository secrets
if [ -z "$APP_PRIVATE_KEY" ]; then
MISSING_SECRETS+=("APP_PRIVATE_KEY (repository secret)")
fi
if [ -z "$GPG_PRIVATE_KEY" ]; then
MISSING_SECRETS+=("GPG_PRIVATE_KEY (repository secret)")
fi
if [ -z "$GPG_PASSPHRASE" ]; then
MISSING_SECRETS+=("GPG_PASSPHRASE (repository secret)")
fi
# Report missing secrets
if [ ${#MISSING_SECRETS[@]} -ne 0 ]; then
echo "❌ Error: The following required secrets/variables are missing:"
for secret in "${MISSING_SECRETS[@]}"; do
echo " - $secret"
done
echo ""
echo "📋 How to add them:"
echo ""
if [[ " ${MISSING_SECRETS[*]} " =~ "APP_ID" ]]; then
echo "🔹 APP_ID (Repository Variable):"
echo " GitHub → Developer settings → GitHub Apps → [Your App] → General → App ID"
echo " Add to: Repository Settings → Secrets and variables → Actions → Variables"
echo ""
fi
if [[ " ${MISSING_SECRETS[*]} " =~ "APP_PRIVATE_KEY" ]]; then
echo "🔹 APP_PRIVATE_KEY (Repository Secret):"
echo " GitHub → Developer settings → GitHub Apps → [Your App] → Private keys → Generate new key"
echo " Add to: Repository Settings → Secrets and variables → Actions → Secrets"
echo ""
fi
if [[ " ${MISSING_SECRETS[*]} " =~ "GPG_PRIVATE_KEY" ]]; then
echo "🔹 GPG_PRIVATE_KEY (Repository Secret):"
echo " Run: ./test-gpg.sh (exports your GPG private key)"
echo " Add to: Repository Settings → Secrets and variables → Actions → Secrets"
echo ""
fi
if [[ " ${MISSING_SECRETS[*]} " =~ "GPG_PASSPHRASE" ]]; then
echo "🔹 GPG_PASSPHRASE (Repository Secret):"
echo " Your GPG key passphrase (used when you created the key)"
echo " Add to: Repository Settings → Secrets and variables → Actions → Secrets"
echo ""
fi
exit 1
fi
echo "✅ All required secrets and variables are present."
env:
APP_ID: ${{ vars.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
build-jars:
name: Build JARs
needs: check-secrets
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ubuntu-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
ubuntu-maven-
- name: Build JARs
run: |
mvn -B -pl core,mcp,starter,cli -am clean package -DskipTests -Pdownload-models
- name: Upload core JAR artifact
uses: actions/upload-artifact@v4
with:
name: core-jar
path: core/target/core-*.jar
if-no-files-found: error
- name: Upload mcp JAR artifact
uses: actions/upload-artifact@v4
with:
name: mcp-jar
path: mcp/target/mcp-*.jar
if-no-files-found: error
- name: Upload starter JAR artifact
uses: actions/upload-artifact@v4
with:
name: starter-jar
path: starter/target/starter-*.jar
if-no-files-found: error
- name: Upload cli JAR artifact
uses: actions/upload-artifact@v4
with:
name: cli-jar
path: cli/target/cli-*.jar
if-no-files-found: error
create-release:
name: Create GitHub Release
needs: build-jars
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Set VERSION
run: |
VERSION=${{ github.ref_name }}
VERSION=${VERSION#v} # Remove 'v' prefix
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
body: |
## Spring Vision ${{ github.ref_name }}
This release includes JARs for core, mcp, starter, and cli modules.
### Downloads
- **Core JAR**: `core-${{ env.VERSION }}.jar`
- **MCP Server JAR**: `mcp-${{ env.VERSION }}.jar` (requires Java 21+)
- **Starter JAR**: `starter-${{ env.VERSION }}.jar`
- **CLI Setup Tool**: `cli-${{ env.VERSION }}.jar` (requires Java 21+)
### Quick Setup (Recommended)
```bash
# Run the CLI setup tool to automatically download and configure everything
jbang https://github.com/codesapienbe/spring-vision/releases/download/v${{ env.VERSION }}/cli-${{ env.VERSION }}.jar
```
### Manual Setup
```bash
# Or run the MCP server directly after setup
jbang ~/.springvision/mcp-${{ env.VERSION }}.jar
```
### Features
- Computer vision capabilities via MCP
- Stdio transport for MCP clients
- Easy to integrate with AI assistants
- One-command setup with CLI tool
draft: false
prerelease: false
deploy-packages:
name: Deploy to GitHub Packages
needs: create-release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ubuntu-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
ubuntu-maven-
- name: Import GPG key
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
echo "GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d'/' -f2)" >> $GITHUB_ENV
- name: Configure Git
run: |
git config --global user.name "codesapienbe"
git config --global user.email "yilmaz@codesapien.net"
git config --global commit.gpgsign true
git config --global user.signingkey ${{ env.GPG_KEY_ID }}
- name: Set VERSION
run: |
VERSION=${{ github.ref_name }}
VERSION=${VERSION#v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Deploying version: $VERSION"
- name: Deploy to GitHub Packages
run: |
mvn -B clean deploy \
-DskipTests \
-Pdownload-models \
-Dmaven.wagon.http.pool=false \
-Dmaven.wagon.httpconnectionManager.ttlSeconds=120
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Log deployment completion
run: |
echo "✅ Version ${{ env.VERSION }} has been successfully deployed to GitHub Packages!"
echo "📦 Artifacts are now available at: https://github.com/codesapienbe/spring-vision/packages"
upload-core:
name: Upload Core JAR
needs: deploy-packages
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Download core JAR artifact
uses: actions/download-artifact@v4
with:
name: core-jar
path: .
- name: Set VERSION
run: |
VERSION=${{ github.ref_name }}
VERSION=${VERSION#v} # Remove 'v' prefix
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Upload Core JAR release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./core-${{ env.VERSION }}.jar
asset_name: core-${{ env.VERSION }}.jar
asset_content_type: application/java-archive
upload-starter:
name: Upload Starter JAR
needs: [ create-release, upload-core ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Download starter JAR artifact
uses: actions/download-artifact@v4
with:
name: starter-jar
path: .
- name: Set VERSION
run: |
VERSION=${{ github.ref_name }}
VERSION=${VERSION#v} # Remove 'v' prefix
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Upload Starter JAR release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./starter-${{ env.VERSION }}.jar
asset_name: starter-${{ env.VERSION }}.jar
asset_content_type: application/java-archive
upload-mcp:
name: Upload MCP JAR
needs: [ create-release, upload-starter ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Download mcp JAR artifact
uses: actions/download-artifact@v4
with:
name: mcp-jar
path: .
- name: Set VERSION
run: |
VERSION=${{ github.ref_name }}
VERSION=${VERSION#v} # Remove 'v' prefix
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Upload MCP JAR release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./mcp-${{ env.VERSION }}.jar
asset_name: mcp-${{ env.VERSION }}.jar
asset_content_type: application/java-archive
upload-cli:
name: Upload CLI JAR
needs: [ create-release, upload-mcp ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Download cli JAR artifact
uses: actions/download-artifact@v4
with:
name: cli-jar
path: .
- name: Set VERSION
run: |
VERSION=${{ github.ref_name }}
VERSION=${VERSION#v} # Remove 'v' prefix
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Upload CLI JAR release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./cli-${{ env.VERSION }}.jar
asset_name: cli-${{ env.VERSION }}.jar
asset_content_type: application/java-archive