Elffuss BraidHub

kikocis/continue public

main · 20.2 KiBRawPermalink
1# GitHub Actions Workflow created for handling the release process based on the draft release prepared with the Build workflow.
2# Running the publishPlugin task requires all following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN.
3# See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information.
4
5name: JetBrains Release
6
7on:
8 release:
9 types: [prereleased]
10 workflow_dispatch:
11 inputs:
12 build_only:
13 description: "If true, only build the extension for the given channels, don't publish"
14 required: true
15 default: "true"
16 eap_channel:
17 description: "If true, build/publish the extension to the EAP channel"
18 required: true
19 default: "true"
20 stable_channel:
21 description: "If true, build/publish the extension to the Stable channel"
22 required: true
23 default: "true"
24
25defaults:
26 run:
27 working-directory: extensions/intellij
28
29concurrency:
30 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
31 cancel-in-progress: true
32
33jobs:
34 check_release_name:
35 runs-on: ubuntu-latest
36 outputs:
37 should_run: ${{ steps.check.outputs.should_run }}
38 steps:
39 - id: check
40 working-directory: .
41 run: |
42 if [[ "${{ github.event.release.tag_name }}" == v1.0.*-jetbrains ]]; then
43 echo "should_run=true" >> $GITHUB_OUTPUT
44 else
45 echo "should_run=false" >> $GITHUB_OUTPUT
46 fi
47
48 # bump-version:
49 # runs-on: ubuntu-latest
50 # needs:
51 # - check_release_name
52 # if: github.event_name != 'workflow_dispatch' || github.event.inputs.eap_channel == 'true' || github.event.inputs.stable_channel == 'true'
53 # permissions:
54 # contents: write
55 # pull-requests: write
56 # steps:
57 # # 0. Setup git
58 # - name: Checkout
59 # uses: actions/checkout@v5
60
61 # - name: Set up Git
62 # run: |
63 # git config --local user.email "action@github.com"
64 # git config --local user.name "GitHub Action"
65
66 # - name: Create PR branch
67 # run: |
68 # BRANCH_NAME="chore/bump-jetbrains-version-$(date +%Y%m%d-%H%M%S)"
69 # git checkout -b $BRANCH_NAME
70 # echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
71
72 # - name: Bump version in gradle.properties
73 # run: |
74 # awk '/pluginVersion=/{split($0,a,"="); split(a[2],b,"."); b[3]+=1; printf "%s=%s.%s.%s\n",a[1],b[1],b[2],b[3];next}1' gradle.properties > tmp && mv tmp gradle.properties
75 # rm -rf tmp
76 # NEW_VERSION=$(grep 'pluginVersion=' gradle.properties | cut -d'=' -f2)
77 # echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
78
79 # - name: Create Pull Request
80 # uses: peter-evans/create-pull-request@v7
81 # with:
82 # token: ${{ secrets.CI_GITHUB_TOKEN }}
83 # commit-message: "chore: bump jetbrains extension version to ${{ env.NEW_VERSION }}"
84 # title: "chore: bump jetbrains extension version to ${{ env.NEW_VERSION }}"
85 # body: |
86 # Automated PR to bump the JetBrains extension version after successful pre-release publication.
87
88 # - Bumped version in extensions/intellij/gradle.properties to ${{ env.NEW_VERSION }}
89 # branch: ${{ env.BRANCH_NAME }}
90 # base: main
91 # delete-branch: true
92
93 # Prepare and publish the plugin to JetBrains Marketplace repository
94 build:
95 needs: check_release_name
96 if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch'
97 name: Build Plugin
98 runs-on: macos-13
99 permissions:
100 contents: write
101 pull-requests: write
102 steps:
103 # Check out current repository
104 - name: Fetch Sources
105 uses: actions/checkout@v5
106 with:
107 ref: ${{ github.event.release.tag_name }}
108
109 - name: Import Apple certificate
110 uses: apple-actions/import-codesign-certs@v5
111 with:
112 keychain: ${{ github.run_id }}
113 keychain-password: ${{ github.run_id }}
114 p12-file-base64: ${{ secrets.APPLE_CERT_DATA }}
115 p12-password: ${{ secrets.APPLE_CERT_PASSWORD }}
116
117 # Validate wrapper
118 - name: Gradle Wrapper Validation
119 uses: gradle/actions/wrapper-validation@v3
120
121 # # Set up Java environment for the next steps
122 - name: Setup Java
123 uses: actions/setup-java@v5
124 with:
125 distribution: zulu
126 java-version: 17
127
128 # # Setup Gradle
129 - name: Setup Gradle
130 uses: gradle/actions/setup-gradle@v3
131 with:
132 gradle-home-cache-cleanup: true
133
134 # Set environment variables
135 - name: Export Properties
136 id: properties
137 shell: bash
138 run: |
139 PROPERTIES="$(./gradlew properties --console=plain -q)"
140 VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
141 # CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
142 CHANGELOG=""
143
144 echo "version=$VERSION" >> $GITHUB_OUTPUT
145 echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
146
147 echo "changelog<<EOF" >> $GITHUB_OUTPUT
148 echo "$CHANGELOG" >> $GITHUB_OUTPUT
149 echo "EOF" >> $GITHUB_OUTPUT
150
151 ./gradlew printProductsReleases # prepare list of IDEs for Plugin Verifier
152
153 # # Setup Node.js
154 - name: Use Node.js from .nvmrc
155 uses: actions/setup-node@v5
156 with:
157 node-version-file: ".nvmrc"
158
159 - name: Cache core node_modules
160 uses: actions/cache@v3
161 with:
162 path: core/node_modules
163 key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }}
164
165 - name: Cache binary node_modules
166 uses: actions/cache@v3
167 with:
168 path: binary/node_modules
169 key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }}
170
171 - name: Cache gui node_modules
172 uses: actions/cache@v3
173 with:
174 path: gui/node_modules
175 key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }}
176
177 - name: Build packages (Unix)
178 run: cd ../.. && node ./scripts/build-packages.js
179
180 # npm install core
181 - name: Install core node_modules
182 run: |
183 cd ../../core
184 npm ci
185
186 # npm install gui
187 - name: Install gui node_modules and build
188 run: |
189 cd ../../gui
190 npm ci
191 npm run build
192 env:
193 NODE_OPTIONS: "--max-old-space-size=8192"
194
195 # Run prepackage.js script
196 - name: Run prepackage script
197 run: |
198 cd ../../extensions/vscode
199 npm ci
200 npm run prepackage
201 env:
202 # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333
203 GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
204
205 # npm install binary
206 - name: Install binary node_modules
207 run: |
208 cd ../../binary
209 npm ci
210
211 # Build binaries
212 - name: Build the binaries
213 run: |
214 cd ../../binary
215 npm run build
216
217 # - name: Code sign darwin binaries
218 # run: |
219 # echo "Signing executable with keychain: ${{ github.run_id }}"
220 # codesign --sign - ../../binary/bin/darwin-x64/continue-binary
221 # codesign --sign - ../../binary/bin/darwin-arm64/continue-binary
222
223 # - name: Sign darwin-arm64 binary
224 # uses: lando/code-sign-action@v2
225 # with:
226 # file: ./binary/bin/darwin-arm64/continue-binary
227 # certificate-data: ${{ secrets.APPLE_CERT_DATA }}
228 # certificate-password: ${{ secrets.APPLE_CERT_PASSWORD }}
229 # apple-notary-user: ${{ secrets.APPLE_NOTARY_USER }}
230 # apple-notary-password: ${{ secrets.APPLE_NOTARY_PASSWORD }}
231 # apple-notary-tool: altool
232 # apple-team-id: 43XFLY66ZD
233 # apple-product-id: dev.continue.continue-binary
234 # options: --options runtime --entitlements entitlements.xml
235
236 # Build the plugin if not publishing
237 - name: Build EAP Plugin (no publish)
238 if: github.event_name != 'release' && github.event.inputs.eap_channel == 'true' && github.event.inputs.build_only == 'true'
239 env:
240 PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }}
241 CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }}
242 PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }}
243 PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }}
244 RELEASE_CHANNEL: eap
245 run: ./gradlew buildPlugin --info --stacktrace
246
247 - name: Build Stable Plugin (no publish)
248 if: github.event_name != 'release' && github.event.inputs.stable_channel == 'true' && github.event.inputs.build_only == 'true'
249 env:
250 PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }}
251 CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }}
252 PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }}
253 PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }}
254 RELEASE_CHANNEL: default
255 run: ./gradlew buildPlugin --info --stacktrace
256
257 # Publish the plugin to JetBrains Marketplace
258 - name: Publish EAP Plugin
259 if: github.event_name == 'release' || (github.event.inputs.eap_channel == 'true' && github.event.inputs.build_only != 'true')
260 continue-on-error: true
261 env:
262 PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }}
263 CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }}
264 PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }}
265 PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }}
266 RELEASE_CHANNEL: eap
267 run: ./gradlew publishPlugin --info --stacktrace
268
269 - name: Publish Stable Plugin
270 if: github.event_name == 'release' || (github.event.inputs.stable_channel == 'true' && github.event.inputs.build_only != 'true')
271 continue-on-error: true
272 env:
273 PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }}
274 CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }}
275 PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }}
276 PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }}
277 RELEASE_CHANNEL: default
278 run: ./gradlew publishPlugin --info --stacktrace
279
280 # Prepare plugin archive content for creating artifact
281 - name: Prepare Plugin Artifact
282 id: artifact
283 shell: bash
284 run: |
285 cd ../../extensions/intellij/build/distributions
286 echo "Contents of distributions folder:"
287 ls
288 echo "---"
289 FILENAME=`ls continue-intellij-extension-*.zip`
290 echo "Filename=${FILENAME}"
291 unzip "$FILENAME" -d content
292
293 echo "filename=${FILENAME%.????}" >> $GITHUB_OUTPUT
294
295 # Store already-built plugin as an artifact for downloading
296 - name: Upload artifact
297 uses: actions/upload-artifact@v4
298 with:
299 name: ${{ steps.artifact.outputs.filename }}
300 path: ./extensions/intellij/build/distributions/content/*/*
301
302 # Upload binaries as artifacts
303 - name: Upload artifact (darwin-arm64)
304 uses: actions/upload-artifact@v4
305 with:
306 name: continue-binary-darwin-arm64
307 path: ./binary/bin/darwin-arm64/
308
309 - name: Upload artifact (darwin-x64)
310 uses: actions/upload-artifact@v4
311 with:
312 name: continue-binary-darwin-x64
313 path: ./binary/bin/darwin-x64/
314
315 - name: Upload artifact (win32-x64)
316 uses: actions/upload-artifact@v4
317 with:
318 name: continue-binary-win32-x64
319 path: ./binary/bin/win32-x64/
320
321 - name: Upload artifact (win32-arm64)
322 uses: actions/upload-artifact@v4
323 with:
324 name: continue-binary-win32-arm64
325 path: ./binary/bin/win32-arm64/
326
327 - name: Upload artifact (linux-arm64)
328 uses: actions/upload-artifact@v4
329 with:
330 name: continue-binary-linux-arm64
331 path: ./binary/bin/linux-arm64/
332
333 - name: Upload artifact (linux-x64)
334 uses: actions/upload-artifact@v4
335 with:
336 name: continue-binary-linux-x64
337 path: ./binary/bin/linux-x64/
338
339 test-binaries:
340 needs: build
341 strategy:
342 matrix:
343 include:
344 - os: windows-latest
345 platform: win32
346 arch: x64
347 npm_config_arch: x64
348 - os: ubuntu-latest
349 platform: linux
350 arch: x64
351 npm_config_arch: x64
352 # arm64 not actually supported by GitHub
353 # - os: ubuntu-latest
354 # platform: linux
355 # arch: arm64
356 # npm_config_arch: arm64
357 - os: macos-12
358 platform: darwin
359 arch: x64
360 npm_config_arch: x64
361 - os: macos-13
362 platform: darwin
363 arch: arm64
364 npm_config_arch: arm64
365 runs-on: ${{ matrix.os }}
366 steps:
367 # 1. Check-out repository
368 - name: Check-out repository
369 uses: actions/checkout@v5
370
371 # 2. Install npm dependencies
372 - name: Use Node.js from .nvmrc
373 uses: actions/setup-node@v5
374 with:
375 node-version-file: ".nvmrc"
376
377 - name: Cache core node_modules
378 uses: actions/cache@v3
379 with:
380 path: core/node_modules
381 key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }}
382
383 - name: Cache binary node_modules
384 uses: actions/cache@v3
385 with:
386 path: binary/node_modules
387 key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }}
388
389 - name: Install Core Dependencies
390 run: |
391 cd ../../core
392 npm ci
393
394 - name: Install Binary Dependencies
395 run: |
396 cd ../../binary
397 npm ci
398
399 # Download the binary artifact
400 - name: Download binary artifact
401 uses: actions/download-artifact@v5
402 with:
403 name: continue-binary-${{ matrix.platform }}-${{ matrix.arch }}
404 path: ./binary/bin/${{ matrix.platform }}-${{ matrix.arch }}/
405
406 # Set execute permissions for the binary (non-Windows)
407 - name: Set execute permissions
408 run: |
409 cd ../../binary/bin/${{ matrix.platform }}-${{ matrix.arch }}
410 chmod +x continue-binary
411 chmod +x build/Release/node_sqlite3.node
412 chmod +x index.node
413 if: ${{ matrix.platform }} != 'win32'
414
415 # Run tests for binary
416 - name: Run binary tests
417 run: |
418 cd ../../binary
419 npm run test
420
421 - name: Upload logs
422 if: ${{ always() }}
423 uses: actions/upload-artifact@v4
424 with:
425 name: core-logs-${{ matrix.platform }}-${{ matrix.arch }}
426 path: ~/.continue/logs/core.log
427
428 # Run tests and upload a code coverage report
429 test:
430 name: Test
431 needs: [build]
432 runs-on: ubuntu-latest
433 steps:
434 # Check out current repository
435 - name: Fetch Sources
436 uses: actions/checkout@v5
437
438 # Set up Java environment for the next steps
439 - name: Setup Java
440 uses: actions/setup-java@v5
441 with:
442 distribution: zulu
443 java-version: 17
444
445 # Setup Gradle
446 - name: Setup Gradle
447 uses: gradle/actions/setup-gradle@v3
448 with:
449 gradle-home-cache-cleanup: true
450
451 # Run tests
452 - name: Run Tests
453 run: ./gradlew check
454
455 # Collect Tests Result of failed tests
456 - name: Collect Tests Result
457 if: ${{ failure() }}
458 uses: actions/upload-artifact@v4
459 with:
460 name: tests-result
461 path: ${{ github.workspace }}/extensions/intellij/build/reports/tests
462
463 # Run Qodana inspections and provide report
464 inspectCode:
465 if: false
466 name: Inspect code
467 needs: [build]
468 runs-on: ubuntu-latest
469 permissions:
470 contents: write
471 checks: write
472 pull-requests: write
473 steps:
474 # Free GitHub Actions Environment Disk Space
475 - name: Maximize Build Space
476 uses: jlumbroso/free-disk-space@main
477 with:
478 tool-cache: false
479 large-packages: false
480
481 # Check out current repository
482 - name: Fetch Sources
483 uses: actions/checkout@v5
484
485 # Set up Java environment for the next steps
486 - name: Setup Java
487 uses: actions/setup-java@v5
488 with:
489 distribution: zulu
490 java-version: 17
491
492 # Run Qodana inspections
493 - name: Qodana - Code Inspection
494 uses: JetBrains/qodana-action@v2025.2.1
495 with:
496 cache-default-branch-only: true
497
498 # Run plugin structure verification along with IntelliJ Plugin Verifier
499 verify:
500 if: false
501 name: Verify plugin
502 needs: [build]
503 runs-on: ubuntu-latest
504 steps:
505 # Free GitHub Actions Environment Disk Space
506 - name: Maximize Build Space
507 uses: jlumbroso/free-disk-space@main
508 with:
509 tool-cache: false
510 large-packages: false
511
512 # Check out current repository
513 - name: Fetch Sources
514 uses: actions/checkout@v5
515
516 # Set up Java environment for the next steps
517 - name: Setup Java
518 uses: actions/setup-java@v5
519 with:
520 distribution: zulu
521 java-version: 17
522
523 # Setup Gradle
524 - name: Setup Gradle
525 uses: gradle/actions/setup-gradle@v3
526 with:
527 gradle-home-cache-cleanup: true
528
529 # Cache Plugin Verifier IDEs
530 - name: Setup Plugin Verifier IDEs Cache
531 uses: actions/cache@v4
532 with:
533 path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
534 key: plugin-verifier-${{ hashFiles('build/printProductsReleases.txt') }}
535
536 # Run Verify Plugin task and IntelliJ Plugin Verifier tool
537 - name: Run Plugin Verification tasks
538 run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
539
540 # Collect Plugin Verifier Result
541 - name: Collect Plugin Verifier Result
542 if: ${{ always() }}
543 uses: actions/upload-artifact@v4
544 with:
545 name: pluginVerifier-result
546 path: ${{ github.workspace }}/build/reports/pluginVerifier
547
548 upload-release:
549 if: false
550 name: Upload Release
551 needs:
552 - build
553 - test-binaries
554 - test
555 runs-on: ubuntu-latest
556 steps:
557 # # Update Unreleased section with the current release note
558 # - name: Patch Changelog
559 # if: ${{ steps.properties.outputs.changelog != '' }}
560 # env:
561 # CHANGELOG: ${{ steps.properties.outputs.changelog }}
562 # run: |
563 # ./gradlew patchChangelog --release-note="$CHANGELOG"
564
565 - name: Download the plugin
566 uses: actions/download-artifact@v5
567 with:
568 name: ${{ steps.artifact.outputs.filename }}
569 path: ./build/distributions/
570
571 # Upload artifact as a release asset
572 # - name: Upload Release Asset
573 # env:
574 # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
575 # run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
576
577 # Publish the plugin to JetBrains Marketplace
578 - name: Publish Plugin
579 env:
580 PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }}
581 CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }}
582 PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }}
583 PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }}
584 run: ./gradlew publishPlugin
585
586 # Create a pull request
587 - name: Create Pull Request
588 if: ${{ steps.properties.outputs.changelog != '' }}
589 env:
590 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
591 run: |
592 VERSION="${{ github.event.release.tag_name }}"
593 BRANCH="changelog-update-$VERSION"
594 LABEL="release changelog"
595
596 git config user.email "action@github.com"
597 git config user.name "GitHub Action"
598
599 git checkout -b $BRANCH
600 git commit -am "Changelog update - $VERSION"
601 git push --set-upstream origin $BRANCH
602
603 gh label create "$LABEL" \
604 --description "Pull requests with release changelog update" \
605 --force \
606 || true
607
608 gh pr create \
609 --title "Changelog update - \`$VERSION\`" \
610 --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
611 --label "$LABEL" \
612 --head $BRANCH