-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added job to publish to maven central
- Loading branch information
Showing
13 changed files
with
199 additions
and
51 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,145 @@ | ||
name: Library Release Deploy | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
workflow_dispatch: | ||
|
||
env: | ||
GITHUB_USERNAME: "meetacy" | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | ||
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY_CONTENTS }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} | ||
|
||
jobs: | ||
|
||
deploy-multiplatform: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release_version: ${{ steps.output_version.outputs.release_version }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Gradle Cache Setup | ||
uses: gradle/[email protected] | ||
- name: Gradle Sync | ||
run: ./gradlew | ||
- name: Add Sdk Version to Env | ||
run: | | ||
release_version=$(./gradlew printVersion -q) | ||
echo "release_version=$release_version" >> $GITHUB_ENV | ||
- name: Publish ${{ env.release_version }} | ||
run: ./gradlew publishKotlinMultiplatformPublicationToMavenCentralRepository | ||
- name: Add Sdk Version to Output | ||
id: output_version | ||
run: echo "release_version=${{ env.release_version }}" >> $GITHUB_OUTPUT | ||
|
||
deploy-jvm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Gradle Cache Setup | ||
uses: gradle/[email protected] | ||
- name: Gradle Sync | ||
run: ./gradlew | ||
- name: Add Sdk Version to Env | ||
run: | | ||
release_version=$(./gradlew printVersion -q) | ||
echo "release_version=$release_version" >> $GITHUB_ENV | ||
- name: Publish ${{ env.release_version }} | ||
run: ./gradlew publishJvmPublicationToMavenCentralRepository | ||
|
||
deploy-js: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Gradle Cache Setup | ||
uses: gradle/[email protected] | ||
- name: Gradle Sync | ||
run: ./gradlew | ||
- name: Add Sdk Version to Env | ||
run: | | ||
release_version=$(./gradlew printVersion -q) | ||
echo "release_version=$release_version" >> $GITHUB_ENV | ||
- name: Publish ${{ env.release_version }} | ||
run: ./gradlew publishJsPublicationToMavenCentralRepository | ||
|
||
deploy-ios-x64: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Gradle Cache Setup | ||
uses: gradle/[email protected] | ||
- name: Konan Cache Setup | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.konan | ||
key: konan-cache | ||
- name: Gradle Sync | ||
run: ./gradlew | ||
- name: Add Sdk Version to Env | ||
run: | | ||
release_version=$(./gradlew printVersion -q) | ||
echo "release_version=$release_version" >> $GITHUB_ENV | ||
- name: Publish ${{ env.release_version }} | ||
run: ./gradlew publishIosX64PublicationToMavenCentralRepository | ||
|
||
deploy-ios-arm64: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Gradle Cache Setup | ||
uses: gradle/[email protected] | ||
- name: Konan Cache Setup | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.konan | ||
key: konan-cache | ||
- name: Gradle Sync | ||
run: ./gradlew | ||
- name: Add Sdk Version to Env | ||
run: | | ||
release_version=$(./gradlew printVersion -q) | ||
echo "release_version=$release_version" >> $GITHUB_ENV | ||
- name: Publish ${{ env.release_version }} | ||
run: ./gradlew publishIosArm64PublicationToMavenCentralRepository | ||
|
||
deploy-ios-simulator-arm64: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Gradle Cache Setup | ||
uses: gradle/[email protected] | ||
- name: Konan Cache Setup | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.konan | ||
key: konan-cache | ||
- name: Gradle Sync | ||
run: ./gradlew | ||
- name: Add Sdk Version to Env | ||
run: | | ||
release_version=$(./gradlew printVersion -q) | ||
echo "release_version=$release_version" >> $GITHUB_ENV | ||
- name: Publish ${{ env.release_version }} | ||
run: ./gradlew publishIosSimulatorArm64PublicationToMavenCentralRepository | ||
|
||
create-release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
needs: | ||
- deploy-multiplatform | ||
- deploy-jvm | ||
- deploy-js | ||
- deploy-ios-x64 | ||
- deploy-ios-arm64 | ||
- deploy-ios-simulator-arm64 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ needs.deploy-multiplatform.outputs.release_version }} | ||
name: Release ${{ needs.deploy-multiplatform.outputs.release_version }} |
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 |
---|---|---|
|
@@ -3,4 +3,3 @@ build | |
.idea | ||
.kotlin | ||
.DS_Store | ||
/gradle/wrapper/gradle-wrapper.jar |
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,7 @@ | ||
Copyright 2024 Alex Sokol | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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
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 |
---|---|---|
|
@@ -4,4 +4,5 @@ plugins { | |
|
||
dependencies { | ||
api(libs.kotlin.gradle.plugin) | ||
api(libs.maven.publish.gradle.plugin) | ||
} |
45 changes: 31 additions & 14 deletions
45
build-logic/src/main/kotlin/publication-convention.gradle.kts
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,24 +1,41 @@ | ||
import com.vanniktech.maven.publish.SonatypeHost | ||
|
||
plugins { | ||
id("org.gradle.maven-publish") | ||
id("com.vanniktech.maven.publish") | ||
} | ||
|
||
group = "app.meetacy.ksm" | ||
group = "me.y9san9.calkt" | ||
|
||
mavenPublishing { | ||
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true) | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
name = "GitHub" | ||
url = uri("https://maven.pkg.github.com/meetacy/ksm") | ||
credentials { | ||
username = System.getenv("GITHUB_USERNAME") | ||
password = System.getenv("GITHUB_TOKEN") | ||
pom { | ||
name = "calkt" | ||
description = "Kotlin library that supports parsing and calculating various expressions" | ||
url = "https://github.com/y9san9/calkt" | ||
|
||
licenses { | ||
license { | ||
name = "MIT" | ||
distribution = "repo" | ||
url = "https://github.com/y9san9/calkt/blob/main/LICENSE.md" | ||
} | ||
} | ||
} | ||
|
||
publications.withType<MavenPublication> { | ||
versionFromProperties { version -> | ||
this.version = version | ||
developers { | ||
developer { | ||
id = "y9san9" | ||
name = "Alex Sokol" | ||
email = "[email protected]" | ||
} | ||
} | ||
|
||
scm { | ||
connection ="scm:git:ssh://github.com/y9san9/calkt.git" | ||
developerConnection = "scm:git:ssh://github.com/y9san9/calkt.git" | ||
url = "https://github.com/y9san9/calkt" | ||
} | ||
} | ||
|
||
signAllPublications() | ||
} |
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,21 +1,5 @@ | ||
plugins { | ||
kotlin("jvm") version "2.0.0" | ||
id("print-version-convention") | ||
} | ||
|
||
group = "me.y9san9" | ||
version = "1.0-SNAPSHOT" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
testImplementation(kotlin("test")) | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
} | ||
kotlin { | ||
jvmToolchain(17) | ||
} | ||
version = libs.versions.calkt.get() |
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
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 +1 @@ | ||
kotlin.code.style=official | ||
kotlin.code.style=official |
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
Binary file not shown.
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
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