Elffuss BraidHub

kikocis/continue public

8eb3ae7b8d16 · 20.3 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@v4
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 env:
261 PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }}
262 CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }}
263 PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }}
264 PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }}
265 RELEASE_CHANNEL: eap
266 run: ./gradlew publishPlugin --info --stacktrace
267
268 - name: Publish Stable Plugin
269 if: github.event_name == 'release' || (github.event.inputs.stable_channel == 'true' && github.event.inputs.build_only != 'true')
270 env:
271 PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }}
272 CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }}
273 PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }}
274 PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }}
275 RELEASE_CHANNEL: default
276 run: ./gradlew publishPlugin --info --stacktrace
277
278 # Prepare plugin archive content for creating artifact
279 - name: Prepare Plugin Artifact
280 id: artifact
281 shell: bash
282 run: |
283 cd ../../extensions/intellij/build/distributions
284 echo "Contents of distributions folder:"
285 ls
286 echo "---"
287 FILENAME=`ls continue-intellij-extension-*.zip`
288 echo "Filename=${FILENAME}"
289 unzip "$FILENAME" -d content
290
291 echo "filename=${FILENAME%.????}" >> $GITHUB_OUTPUT
292
293 # Store already-built plugin as an artifact for downloading
294 - name: Upload artifact
295 uses: actions/upload-artifact@v4
296 with:
297 name: ${{ steps.artifact.outputs.filename }}
298 path: ./extensions/intellij/build/distributions/content/*/*
299
300 # Upload binaries as artifacts
301 - name: Upload artifact (darwin-arm64)
302 uses: actions/upload-artifact@v4
303 with:
304 name: continue-binary-darwin-arm64
305 path: ./binary/bin/darwin-arm64/
306
307 - name: Upload artifact (darwin-x64)
308 uses: actions/upload-artifact@v4
309 with:
310 name: continue-binary-darwin-x64
311 path: ./binary/bin/darwin-x64/
312
313 - name: Upload artifact (win32-x64)
314 uses: actions/upload-artifact@v4
315 with:
316 name: continue-binary-win32-x64
317 path: ./binary/bin/win32-x64/
318
319 - name: Upload artifact (win32-arm64)
320 uses: actions/upload-artifact@v4
321 with:
322 name: continue-binary-win32-arm64
323 path: ./binary/bin/win32-arm64/
324
325 - name: Upload artifact (linux-arm64)
326 uses: actions/upload-artifact@v4
327 with:
328 name: continue-binary-linux-arm64
329 path: ./binary/bin/linux-arm64/
330
331 - name: Upload artifact (linux-x64)
332 uses: actions/upload-artifact@v4
333 with:
334 name: continue-binary-linux-x64
335 path: ./binary/bin/linux-x64/
336
337 test-binaries:
338 needs: build
339 strategy:
340 matrix:
341 include:
342 - os: windows-latest
343 platform: win32
344 arch: x64
345 npm_config_arch: x64
346 - os: ubuntu-latest
347 platform: linux
348 arch: x64
349 npm_config_arch: x64
350 # arm64 not actually supported by GitHub
351 # - os: ubuntu-latest
352 # platform: linux
353 # arch: arm64
354 # npm_config_arch: arm64
355 - os: macos-12
356 platform: darwin
357 arch: x64
358 npm_config_arch: x64
359 - os: macos-13
360 platform: darwin
361 arch: arm64
362 npm_config_arch: arm64
363 runs-on: ${{ matrix.os }}
364 steps:
365 # 1. Check-out repository
366 - name: Check-out repository
367 uses: actions/checkout@v5
368
369 # 2. Install npm dependencies
370 - name: Use Node.js from .nvmrc
371 uses: actions/setup-node@v4
372 with:
373 node-version-file: ".nvmrc"
374
375 - name: Cache core node_modules
376 uses: actions/cache@v3
377 with:
378 path: core/node_modules
379 key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }}
380
381 - name: Cache binary node_modules
382 uses: actions/cache@v3
383 with:
384 path: binary/node_modules
385 key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }}
386
387 - name: Install Core Dependencies
388 run: |
389 cd ../../core
390 npm ci
391
392 - name: Install Binary Dependencies
393 run: |
394 cd ../../binary
395 npm ci
396
397 # Download the binary artifact
398 - name: Download binary artifact
399 uses: actions/download-artifact@v5
400 with:
401 name: continue-binary-${{ matrix.platform }}-${{ matrix.arch }}
402 path: ./binary/bin/${{ matrix.platform }}-${{ matrix.arch }}/
403
404 # Set execute permissions for the binary (non-Windows)
405 - name: Set execute permissions
406 run: |
407 cd ../../binary/bin/${{ matrix.platform }}-${{ matrix.arch }}
408 chmod +x continue-binary
409 chmod +x build/Release/node_sqlite3.node
410 chmod +x index.node
411 if: ${{ matrix.platform }} != 'win32'
412
413 # Run tests for binary
414 - name: Run binary tests
415 run: |
416 cd ../../binary
417 npm run test
418
419 - name: Upload logs
420 if: ${{ always() }}
421 uses: actions/upload-artifact@v4
422 with:
423 name: core-logs-${{ matrix.platform }}-${{ matrix.arch }}
424 path: ~/.continue/logs/core.log
425
426 # Run tests and upload a code coverage report
427 test:
428 name: Test
429 needs: [build]
430 runs-on: ubuntu-latest
431 steps:
432 # Check out current repository
433 - name: Fetch Sources
434 uses: actions/checkout@v5
435
436 # Set up Java environment for the next steps
437 - name: Setup Java
438 uses: actions/setup-java@v5
439 with:
440 distribution: zulu
441 java-version: 17
442
443 # Setup Gradle
444 - name: Setup Gradle
445 uses: gradle/actions/setup-gradle@v3
446 with:
447 gradle-home-cache-cleanup: true
448
449 # Run tests
450 - name: Run Tests
451 run: ./gradlew check
452
453 # Collect Tests Result of failed tests
454 - name: Collect Tests Result
455 if: ${{ failure() }}
456 uses: actions/upload-artifact@v4
457 with:
458 name: tests-result
459 path: ${{ github.workspace }}/extensions/intellij/build/reports/tests
460
461 # Upload the Kover report to CodeCov
462 # - name: Upload Code Coverage Report
463 # uses: codecov/codecov-action@v4
464 # with:
465 # files: ${{ github.workspace }}/build/reports/kover/report.xml
466
467 # Run Qodana inspections and provide report
468 inspectCode:
469 if: false
470 name: Inspect code
471 needs: [build]
472 runs-on: ubuntu-latest
473 permissions:
474 contents: write
475 checks: write
476 pull-requests: write
477 steps:
478 # Free GitHub Actions Environment Disk Space
479 - name: Maximize Build Space
480 uses: jlumbroso/free-disk-space@main
481 with:
482 tool-cache: false
483 large-packages: false
484
485 # Check out current repository
486 - name: Fetch Sources
487 uses: actions/checkout@v5
488
489 # Set up Java environment for the next steps
490 - name: Setup Java
491 uses: actions/setup-java@v5
492 with:
493 distribution: zulu
494 java-version: 17
495
496 # Run Qodana inspections
497 - name: Qodana - Code Inspection
498 uses: JetBrains/qodana-action@v2025.2.1
499 with:
500 cache-default-branch-only: true
501
502 # Run plugin structure verification along with IntelliJ Plugin Verifier
503 verify:
504 if: false
505 name: Verify plugin
506 needs: [build]
507 runs-on: ubuntu-latest
508 steps:
509 # Free GitHub Actions Environment Disk Space
510 - name: Maximize Build Space
511 uses: jlumbroso/free-disk-space@main
512 with:
513 tool-cache: false
514 large-packages: false
515
516 # Check out current repository
517 - name: Fetch Sources
518 uses: actions/checkout@v5
519
520 # Set up Java environment for the next steps
521 - name: Setup Java
522 uses: actions/setup-java@v5
523 with:
524 distribution: zulu
525 java-version: 17
526
527 # Setup Gradle
528 - name: Setup Gradle
529 uses: gradle/actions/setup-gradle@v3
530 with:
531 gradle-home-cache-cleanup: true
532
533 # Cache Plugin Verifier IDEs
534 - name: Setup Plugin Verifier IDEs Cache
535 uses: actions/cache@v4
536 with:
537 path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
538 key: plugin-verifier-${{ hashFiles('build/printProductsReleases.txt') }}
539
540 # Run Verify Plugin task and IntelliJ Plugin Verifier tool
541 - name: Run Plugin Verification tasks
542 run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
543
544 # Collect Plugin Verifier Result
545 - name: Collect Plugin Verifier Result
546 if: ${{ always() }}
547 uses: actions/upload-artifact@v4
548 with:
549 name: pluginVerifier-result
550 path: ${{ github.workspace }}/build/reports/pluginVerifier
551
552 upload-release:
553 if: false
554 name: Upload Release
555 needs:
556 - build
557 - test-binaries
558 - test
559 runs-on: ubuntu-latest
560 steps:
561 # # Update Unreleased section with the current release note
562 # - name: Patch Changelog
563 # if: ${{ steps.properties.outputs.changelog != '' }}
564 # env:
565 # CHANGELOG: ${{ steps.properties.outputs.changelog }}
566 # run: |
567 # ./gradlew patchChangelog --release-note="$CHANGELOG"
568
569 - name: Download the plugin
570 uses: actions/download-artifact@v5
571 with:
572 name: ${{ steps.artifact.outputs.filename }}
573 path: ./build/distributions/
574
575 # Upload artifact as a release asset
576 # - name: Upload Release Asset
577 # env:
578 # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
579 # run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*
580
581 # Publish the plugin to JetBrains Marketplace
582 - name: Publish Plugin
583 env:
584 PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }}
585 CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }}
586 PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }}
587 PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }}
588 run: ./gradlew publishPlugin
589
590 # Create a pull request
591 - name: Create Pull Request
592 if: ${{ steps.properties.outputs.changelog != '' }}
593 env:
594 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
595 run: |
596 VERSION="${{ github.event.release.tag_name }}"
597 BRANCH="changelog-update-$VERSION"
598 LABEL="release changelog"
599
600 git config user.email "action@github.com"
601 git config user.name "GitHub Action"
602
603 git checkout -b $BRANCH
604 git commit -am "Changelog update - $VERSION"
605 git push --set-upstream origin $BRANCH
606
607 gh label create "$LABEL" \
608 --description "Pull requests with release changelog update" \
609 --force \
610 || true
611
612 gh pr create \
613 --title "Changelog update - \`$VERSION\`" \
614 --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
615 --label "$LABEL" \
616 --head $BRANCH