Elffuss BraidHub

kikocis/continue public

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