Skip to content

Commit

Permalink
Adapted publication logic for 232
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamberto Basti authored and lamba92 committed Dec 4, 2023
1 parent 2ecf21f commit 2ee98fe
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish to Marketplace

on:
release:
types: [published]

jobs:
publish:
name: Publish Package Search to Marketplace
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
- uses: gradle/gradle-build-action@v2
- name: Run :publishShadowPlugin task
run: ./gradlew :plugin:publishShadowPluginToMarketplace publishAllPublicationsToSpaceRepository
env:
MARKETPLACE_TOKEN: ${{ secrets.MARKETPLACE_TOKEN }}
GRADLE_ENTERPRISE_KEY: ${{ secrets.GRADLE_ENTERPRISE_KEY }}
MAVEN_SPACE_PASSWORD: ${{ secrets.MAVEN_SPACE_PASSWORD }}
MAVEN_SPACE_USERNAME: ${{ secrets.MAVEN_SPACE_USERNAME }}
28 changes: 28 additions & 0 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish snapshot to TBE

on:
push:
branches: [ master ]

jobs:
publish:
name: Publish Package Search Snapshot to TBE
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
cache: gradle
- uses: gradle/gradle-build-action@v2
- name: Run :publishShadowPlugin task
run: ./gradlew :plugin:publishShadowPlugin publishAllPublicationsToSpaceRepository
env:
TOOLBOX_ENTERPRISE_TOKEN: ${{ secrets.TOOLBOX_ENTERPRISE_TOKEN }}
GRADLE_ENTERPRISE_KEY: ${{ secrets.GRADLE_ENTERPRISE_KEY }}
MAVEN_SPACE_PASSWORD: ${{ secrets.MAVEN_SPACE_PASSWORD }}
MAVEN_SPACE_USERNAME: ${{ secrets.MAVEN_SPACE_USERNAME }}
9 changes: 8 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ plugins {

allprojects {
group = "org.jetbrains.packagesearch"
version = "1.1.0"
val baseVersion = "232.10227-SNAPSHOT"
version = when (val ref = getenv("GITHUB_REF")) {
null -> baseVersion
else -> when {
ref.startsWith("refs/tags/") -> ref.removePrefix("refs/tags/")
else -> baseVersion
}
}

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fun Project.configureGradleIntellijPlugin(packageSearchExtension: PackageSearchE

plugins.withId("org.jetbrains.intellij") {
extensions.withType<IntelliJPluginExtension> {
version = "2023.2.5"
version = "232.10227.8"
instrumentCode = false
downloadSources = !isCI
}
Expand Down
23 changes: 22 additions & 1 deletion plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,33 @@ tasks {
prepareSandbox {
runtimeClasspathFiles = tooling
}
val snapshotDateSuffix = buildString {
val now = Clock.System.now().toLocalDateTime(TimeZone.UTC)
append(now.year)
append(now.monthNumber)
append(now.dayOfMonth)
append(now.hour.toString().padStart(2, '0'))
append(now.minute.toString().padStart(2, '0'))
append(now.second.toString().padStart(2, '0'))
}
patchPluginXml {
pluginId = pkgsPluginId
version = when {
project.version.toString().endsWith("-SNAPSHOT") -> "${project.version}-$snapshotDateSuffix"
else -> project.version.toString()
}
}
val buildShadowPlugin by registering(Zip::class) {
group = "intellij"
from(shadowJar)
from(shadowJar) {
rename {
"package-search-plugin" + when {
it.endsWith("-SNAPSHOT.jar") -> it.replace(".jar", "-$snapshotDateSuffix.jar")
.also { logger.lifecycle("Snapshot version -> $it") }
else -> it
}
}
}
from(tooling) {
rename { "gradle-tooling.jar" }
}
Expand Down

0 comments on commit 2ee98fe

Please sign in to comment.