Skip to content

Commit 60a7d41

Browse files
authored
GitHub release (#201)
* add release workflow * bump version to 2.1.14 end up using nexus publish plugin, with macos should be able to release all artifacts type. Right now linux and mac are published, with 1.6 windows will also be supported: https://kotlinlang.org/docs/whatsnew16.html#compilation-of-windows-targets-on-any-host
1 parent 387b232 commit 60a7d41

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

.github/workflows/cd.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
name: CD
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- github-release
47

58
jobs:
6-
snapshot:
7-
if: success() && github.ref == 'refs/heads/github-release'
8-
runs-on: ${{ matrix.os }}
9-
strategy:
10-
matrix:
11-
os: [ubuntu-latest, macOS-latest, windows-latest]
9+
release:
10+
runs-on: macos-latest
1211
steps:
1312
- name: Checkout
1413
uses: actions/checkout@v2
@@ -17,9 +16,12 @@ jobs:
1716
with:
1817
java-version: 8
1918
- name: Publish
20-
run: ./gradlew publishAllPublicationsToOss
19+
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -no-daemon --no-parallel --stacktrace -DSONATYPE_USERNAME=$SONATYPE_USERNAME -DSONATYPE_PASSWORD=$SONATYPE_PASSWORD -DGPG_PRIVATE_PASSWORD=$GPG_PRIVATE_PASSWORD -DGPG_PRIVATE_KEY=$GPG_PRIVATE_KEY
2120
env:
2221
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
2322
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
23+
SONATYPE_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository_id }}
2424
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
2525
GPG_PRIVATE_PASSWORD: ${{ secrets.GPG_PRIVATE_PASSWORD }}
26+
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
27+
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}

build.gradle.kts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ plugins {
1414
apply("versions.gradle.kts")
1515

1616
group = "io.github.microutils"
17-
version = "2.1.2"
17+
version = "2.1.14"
1818

1919
repositories {
2020
mavenCentral()
@@ -26,6 +26,8 @@ nexusPublishing {
2626
}
2727
}
2828

29+
apply(plugin = "io.github.gradle-nexus.publish-plugin")
30+
2931
kotlin {
3032
explicitApi()
3133
jvm {
@@ -127,8 +129,8 @@ tasks {
127129
}
128130
}
129131

130-
val sonatypeUsername: String? = System.getenv("SONATYPE_USERNAME")
131-
val sonatypePassword: String? = System.getenv("SONATYPE_PASSWORD")
132+
133+
132134
publishing {
133135
publications.withType<MavenPublication> {
134136
pom {
@@ -156,23 +158,13 @@ publishing {
156158
}
157159
}
158160
artifact(tasks["dokkaJar"])
159-
repositories {
160-
maven {
161-
name = "oss"
162-
url = uri("https://oss.sonatype.org/service/local/staging/deployByRepositoryId/kotlin-logging/")
163-
credentials {
164-
username = sonatypeUsername
165-
password = sonatypePassword
166-
}
167-
}
168-
}
169161
}
170162
}
171163

172164
signing {
173165
useInMemoryPgpKeys(
174-
System.getenv("GPG_PRIVATE_KEY"),
175-
System.getenv("GPG_PRIVATE_PASSWORD")
166+
System.getProperty("GPG_PRIVATE_KEY"),
167+
System.getProperty("GPG_PRIVATE_PASSWORD")
176168
)
177169
sign(publishing.publications)
178170
}

0 commit comments

Comments
 (0)