Skip to content

Commit

Permalink
Setup publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
t895 committed Sep 9, 2024
1 parent 25535e6 commit 2ace928
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 109 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: mcstatuskt-publish

on:
push:
branches: [ main ]
workflow_dispatch:

jobs:
publish:
if: ${{ github.repository == 't895/mcstatuskt' }}
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Give execution permissions to the gradle wrapper
run: chmod +x ./gradlew
- name: Create secrets file
run: |
echo "${{secrets.SIGNING_SECRET_KEYRING_BASE64}}" | base64 --decode > ${HOME}/keyring.asc
gpg --output ${HOME}/keyring.asc.gpg --dearmor ${HOME}/keyring.asc
- name: Set up environment
run: |
echo "mavenCentralUsername=${{secrets.MAVEN_USERNAME}}" >> gradle.properties
echo "mavenCentralPassword=${{secrets.MAVEN_PASSWORD}}" >> gradle.properties
echo "signing.keyId=${{secrets.SIGNING_KEY_ID}}" >> gradle.properties
echo "signing.password=${{secrets.SIGNING_PASSWORD}}" >> gradle.properties
echo "signing.secretKeyRingFile=${HOME}/keyring.asc.gpg" >> gradle.properties
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Build and publish
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ plugins {
alias(libs.plugins.android.library).apply(false)
alias(libs.plugins.kotlinx.serialization).apply(false)
id("org.jetbrains.kotlinx.atomicfu") version "0.25.0" apply false
id("com.vanniktech.maven.publish") version "0.28.0" apply false
}
7 changes: 0 additions & 7 deletions convention-plugins/build.gradle.kts

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ org.gradle.parallel=true
#Kotlin
kotlin.code.style=official
kotlin.daemon.jvmargs=-Xmx4G
kotlin.native.ignoreDisabledTargets=true

#Android
android.useAndroidX=true
Expand Down
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ dependencyResolutionManagement {
mavenCentral()
}
}
includeBuild("convention-plugins")
include(":shared")
50 changes: 48 additions & 2 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import com.vanniktech.maven.publish.SonatypeHost

plugins {
alias(libs.plugins.multiplatform)
alias(libs.plugins.android.library)
alias(libs.plugins.kotlinx.serialization)
id("org.jetbrains.kotlinx.atomicfu")
id("convention.publication")
id("com.vanniktech.maven.publish")
}

group = "com.t895.mcstatuskt"
version = "1.0"
version = "0.1.0"

kotlin {
jvmToolchain(17)
Expand Down Expand Up @@ -74,3 +76,47 @@ android {
minSdk = 21
}
}

mavenPublishing {
// Define coordinates for the published artifact
coordinates(
groupId = "io.github.t895",
artifactId = "mcstatuskt",
version = "0.1.0"
)

// Configure POM metadata for the published artifact
pom {
name.set("mcstatuskt")
description.set("Simple Minecraft Server pinger")
inceptionYear.set("2024")
url.set("https://github.com/t895/mcstatuskt")

licenses {
license {
name.set("GPLv3")
url.set("https://opensource.org/licenses/gpl-3-0")
}
}

// Specify developer information
developers {
developer {
id.set("t895")
name.set("Charles Lombardo")
email.set("[email protected]")
}
}

// Specify SCM information
scm {
url.set("https://github.com/t895/mcstatuskt")
}
}

// Configure publishing to Maven Central
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)

// Enable GPG signing for all publications
signAllPublications()
}

0 comments on commit 2ace928

Please sign in to comment.