-
Notifications
You must be signed in to change notification settings - Fork 623
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated github workflow for dispatch release
- Loading branch information
Showing
2 changed files
with
75 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "The release version" | ||
required: true | ||
|
||
jobs: | ||
deploy-linux-and-common: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: deploy to sonatype | ||
run: ./gradlew publish | ||
env: | ||
RELEASE_VERSION: ${{ github.event.inputs.version }} | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} | ||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} | ||
|
||
deploy-mac: | ||
runs-on: macOS-latest | ||
|
||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: deploy to sonatype | ||
run: ./gradlew publishMacosX64PublicationToDeployRepository | ||
env: | ||
RELEASE_VERSION: ${{ github.event.inputs.version }} | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} | ||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} | ||
|
||
deploy-windows: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Checkout the repo | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: deploy to sonatype | ||
run: ./gradlew publishMingwX64PublicationToDeployRepository | ||
env: | ||
RELEASE_VERSION: ${{ github.event.inputs.version }} | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} | ||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} | ||
|
||
env: | ||
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=true -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,18 @@ | ||
object Ci { | ||
|
||
private const val lastRelease = "4.1.2" | ||
|
||
// this is the version used for building snapshots | ||
// .buildnumber-snapshot will be appended | ||
private const val snapshotBase = "4.2.0" | ||
|
||
private val githubBuildNumber: String = System.getenv("GITHUB_RUN_NUMBER") ?: "0" | ||
private val snapshotVersion = "$snapshotBase.${githubBuildNumber}-SNAPSHOT" | ||
|
||
private val releaseTag = detectReleaseTag().apply { | ||
println("Release tag: $this") | ||
} | ||
private val githubBuildNumber = System.getenv("GITHUB_RUN_NUMBER") | ||
|
||
private fun detectReleaseTag(): String? { | ||
return try { | ||
val process = Runtime.getRuntime().exec("git log -1 --pretty=%B") | ||
val reader = process.inputStream.bufferedReader() | ||
val tag: String? = reader.readLine() | ||
if (tag != null && tag.isNotBlank() && tag.trim().startsWith("v")) tag.trim().removePrefix("v") else null | ||
} catch (e: Exception) { | ||
println("git tag failed " + e.message) | ||
e.printStackTrace() | ||
null | ||
} | ||
private val snapshotVersion = when (githubBuildNumber) { | ||
null -> "$snapshotBase-LOCAL" | ||
else -> "$snapshotBase.${githubBuildNumber}-SNAPSHOT" | ||
} | ||
|
||
val isRelease = releaseTag != null | ||
private val releaseVersion = System.getenv("RELEASE_VERSION") | ||
|
||
val publishVersion: String = when (releaseTag) { | ||
null -> snapshotVersion | ||
else -> releaseTag | ||
} | ||
val isRelease = releaseVersion != null | ||
val publishVersion = releaseVersion ?: snapshotVersion | ||
} |