Skip to content

Commit

Permalink
ci(intellij): add support to publish to the intellij marketplace when…
Browse files Browse the repository at this point in the history
… a new plugin version is available
  • Loading branch information
chrissimon-au committed Mar 11, 2024
1 parent 549a992 commit 71027ed
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 33 deletions.
29 changes: 28 additions & 1 deletion .github/workflows/contextive-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
matrix-path: .github/release-matrix.yml

build-test-publish:
publish-per-runtime:
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.get-matrix.outputs.matrix) }}
Expand All @@ -25,3 +25,30 @@ jobs:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}

publish-intellij:
name: Contextive IntelliJ Publish
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- uses: ./.github/actions/init-dotnet

- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'

- name: Build
id: build
run: dotnet fsi intellij/build.fsx -- --release ${{ github.ref_name }}
working-directory: src
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }}
PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }}
PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }}
PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }}


30 changes: 0 additions & 30 deletions .github/workflows/contextive-runtime-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,33 +69,3 @@ jobs:
with:
name: 'Contextive VsCode Extension'
reporter: java-junit

intellij:
name: IntelliJ Plugin
needs:
- language-server
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'

# - name: Language Server Artifact
# uses: actions/download-artifact@v3
# with:
# name: Contextive.LanguageServer-${{ inputs.dotnet_runtime }}
# path: src/

- name: Build
run: ./gradlew build
working-directory: src/intellij/contextive

# - uses: ./.github/actions/upload-reports
# if: always()
# with:
# name: 'Contextive VsCode Extension'
# reporter: java-junit
32 changes: 30 additions & 2 deletions .github/workflows/contextive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,40 @@ jobs:
with:
matrix-path: .github/build-matrix.yml

build-test:
build-test-per-runtime:
needs: get-matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.get-matrix.outputs.matrix) }}
uses: ./.github/workflows/contextive-runtime-build.yml
with:
dotnet_runtime: ${{ matrix.dotnet_runtime }}
os: ${{ matrix.os }}
os: ${{ matrix.os }}

build-test-intellij:
name: IntelliJ Plugin
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'

# - name: Language Server Artifact
# uses: actions/download-artifact@v3
# with:
# name: Contextive.LanguageServer-${{ inputs.dotnet_runtime }}
# path: src/

- name: Build
run: ./gradlew build
working-directory: src/intellij/contextive

# - uses: ./.github/actions/upload-reports
# if: always()
# with:
# name: 'Contextive VsCode Extension'
# reporter: java-junit
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"Intelli",
"intellij",
"ionide",
"JETBRAINS",
"MADR",
"paket",
"parens",
Expand Down
38 changes: 38 additions & 0 deletions src/intellij/build.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#r "nuget: Fun.Build, 1.0.5"
#load "../ci/common.fsx"

open Fun.Build

open Common

let distPath: string = "intellij/contextive/build/distribution"

let intelliJAssetFileName (ctx: Internal.StageContext) =
$"contextive-{ctx.GetCmdArg(args.release)}-signed.zip"

pipeline "Contextive IntelliJ Plugin" {
description "Build & Test"
noPrefixForStep
runBeforeEachStage gitHubGroupStart
runAfterEachStage gitHubGroupEnd

logEnvironment

stage "Publish" {
workingDir "intellij/contextive"
whenCmdArg args.release

stage "Sign Plugin" { run "./gradlew signPlugin" }

stage "Upload Asset" {
workingDir distPath
run (fun ctx -> $"gh release upload {ctx.GetCmdArg(args.release)} {intelliJAssetFileName ctx}")
}

stage "Publish Package" { run "./gradlew publishPlugin" }
}

runIfOnlySpecified false
}

tryPrintPipelineCommandHelp ()

0 comments on commit 71027ed

Please sign in to comment.