Skip to content

Commit

Permalink
ci(intellij): add release actions. (#3241)
Browse files Browse the repository at this point in the history
  • Loading branch information
icycodes authored Oct 5, 2024
1 parent f6b64b0 commit c1e5366
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 18 deletions.
140 changes: 140 additions & 0 deletions .github/workflows/release-intellij.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: Release Tabby Plugin for IntelliJ Platform

on:
workflow_dispatch:
push:
tags:
- "intellij@*"

concurrency:
group: ${{ github.workflow_ref }}-${{ github.head_ref || github.ref_name }}

# If this is enabled it will cancel current running and start latest
cancel-in-progress: true

jobs:
release-marketplace:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true

- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Determine Publish Channel
env:
VERSION_STRING:
run: |
if [[ ${{ github.ref_name }} =~ intellij@[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "PUBLISH_CHANNEL=stable" >> $GITHUB_ENV
else
echo "PUBLISH_CHANNEL=alpha" >> $GITHUB_ENV
fi
- name: Check Publish Channel
run: echo "Publish Channel is ${{ env.PUBLISH_CHANNEL }}"

- name: Publish Plugin to Marketplace
env:
CERTIFICATE_CHAIN: ${{ secrets.INTELLIJ_PLUGIN_CERTIFICATE_CHAIN }}
PRIVATE_KEY: ${{ secrets.INTELLIJ_PLUGIN_PRIVATE_KEY }}
PUBLISH_TOKEN: ${{ secrets.INTELLIJ_PLUGIN_PUBLISH_TOKEN }}
PUBLISH_CHANNEL: ${{ env.PUBLISH_CHANNEL }}
uses: gradle/gradle-build-action@v2.4.2
with:
arguments: publishPlugin
build-root-directory: clients/intellij

release-github:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
lfs: true

- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Build Signed Plugin
env:
CERTIFICATE_CHAIN: ${{ secrets.INTELLIJ_PLUGIN_CERTIFICATE_CHAIN }}
PRIVATE_KEY: ${{ secrets.INTELLIJ_PLUGIN_PRIVATE_KEY }}
uses: gradle/gradle-build-action@v2.4.2
with:
arguments: signPlugin
build-root-directory: clients/intellij

- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
prerelease: true
tag: ${{ github.ref_name }}
removeArtifacts: true
artifacts: "clients/intellij/build/distributions/intellij-tabby-signed.zip"
21 changes: 4 additions & 17 deletions .github/workflows/test-intellij.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ concurrency:
jobs:
build:
runs-on: ubuntu-latest
env:
CERTIFICATE_CHAIN: ${{ secrets.INTELLIJ_PLUGIN_CERTIFICATE_CHAIN }}
PRIVATE_KEY: ${{ secrets.INTELLIJ_PLUGIN_PRIVATE_KEY }}
PRIVATE_KEY_PASSWORD: ${{ secrets.INTELLIJ_PLUGIN_PRIVATE_KEY_PASSWORD }}

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -39,8 +34,8 @@ jobs:
with:
node-version: 18

- uses: pnpm/action-setup@v4
name: Install pnpm
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
Expand All @@ -50,8 +45,8 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
Expand All @@ -66,11 +61,3 @@ jobs:
with:
arguments: buildPlugin
build-root-directory: clients/intellij

- name: Upload Plugin
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: artifacts
path: |
clients/intellij/build/distributions/intellij-tabby.zip
1 change: 0 additions & 1 deletion clients/intellij/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ tasks {
signing {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}
publishing {
token.set(System.getenv("PUBLISH_TOKEN"))
Expand Down

0 comments on commit c1e5366

Please sign in to comment.