Skip to content

Commit

Permalink
chore: support for publishing in different channels
Browse files Browse the repository at this point in the history
  • Loading branch information
kmruiz committed May 9, 2024
1 parent 8c9a864 commit 74687f0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/draft-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ jobs:
run: |
./gradlew ":packages:jetbrains-plugin:patchChangelog"
- name: Build Plugin
- name: Sign and Publish Plugin in Beta
env:
JB_PUBLISH_CHANNEL: "beta"
run: |
./gradlew ":packages:jetbrains-plugin:buildPlugin"
./gradlew ":packages:jetbrains-plugin:publishPlugin"
- name: Create Draft Release
shell: bash
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ jobs:
tag: ${{ github.ref_name }}
fileName: 'jetbrains-plugin.zip'
out-file-path: 'packages/jetbrains-plugin/build/distributions/'
- name: Publish into JetBrains Marketplace
- name: Publish Plugin In General Availability
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.SVC_DEVTOOLSBOT_TOKEN }}
JB_PUBLISH_CHANNEL: "ga"
run: |
set -e
./gradlew ":packages:jetbrains-plugin:publishPlugin" $(./gradlew ":packages:jetbrains-plugin:publishPlugin" --dry-run | awk '/^:/ { print "-x" $1 }' | sed '$ d')
git checkout main
git merge ${{ github.ref_name }}
git push origin main
./gradlew ":packages:jetbrains-plugin:signPlugin" $(./gradlew ":packages:jetbrains-plugin:signPlugin" --dry-run | awk '/^:/ { print "-x" $1 }' | sed '$ d')
./gradlew ":packages:jetbrains-plugin:publishPlugin" $(./gradlew ":packages:jetbrains-plugin:publishPlugin" --dry-run | awk '/^:/ { print "-x" $1 }' | sed '$ d')
20 changes: 14 additions & 6 deletions packages/jetbrains-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ tasks {
destinationFile.set(project.layout.buildDirectory.file("classes/kotlin/main/build.properties"))
property("pluginVersion", rootProject.version)
property("driverVersion", rootProject.libs.versions.mongodb.driver.get())
property("segmentApiKey", System.getenv("SEGMENT_API_KEY") ?: "<none>")
property("segmentApiKey", System.getenv("BUILD_SEGMENT_API_KEY") ?: "<none>")
}

withType<KotlinCompile>() {
withType<KotlinCompile> {
dependsOn("buildProperties")
}

Expand All @@ -101,13 +101,21 @@ tasks {
}

signPlugin {
outputArchiveFile=project.layout.buildDirectory.file("distributions/jetbrains-plugin.zip").get()
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
certificateChain.set(System.getenv("JB_CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("JB_PRIVATE_KEY"))
password.set(System.getenv("JB_PRIVATE_KEY_PASSWORD"))
}

publishPlugin {
channels = when (System.getenv("JB_PUBLISH_CHANNEL")) {
"ga" -> listOf()
"beta" -> listOf("beta")
else -> if (gradle.startParameter.taskNames.contains("publishPlugin")) {
throw RuntimeException("Invalid channel. Only `ga` and `beta` accepted.")
} else {
listOf("<unused>")
}
}
token.set(System.getenv("PUBLISH_TOKEN"))
}
}
Expand Down

0 comments on commit 74687f0

Please sign in to comment.