Skip to content

Commit 7c34157

Browse files
committed
Add Maven Central publishing
1 parent 93e96e6 commit 7c34157

File tree

5 files changed

+129
-20
lines changed

5 files changed

+129
-20
lines changed

.github/workflows/publish.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish Amuze
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Setup JDK
19+
uses: actions/setup-java@v4
20+
with:
21+
distribution: 'adopt'
22+
java-version: '17'
23+
24+
- name: Setup Gradle
25+
uses: gradle/actions/setup-gradle@v4
26+
27+
- name: Publish to Maven Central
28+
run: ./gradlew amuze:publishAllPublicationsToMavenCentral
29+
env:
30+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
31+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
32+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }}
33+
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
34+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
35+
36+
- name: Publish to Github Packages
37+
run: ./gradlew amuze:publish
38+
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

+25-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
11

2-
name: Publish Amuze to GitHub Packages
2+
name: Release
3+
34
on:
4-
release:
5-
types: [created]
5+
push:
6+
tags:
7+
- 'v*'
8+
69
jobs:
7-
publish:
8-
runs-on: ubuntu-latest
9-
permissions:
10-
contents: read
11-
packages: write
12-
steps:
13-
- uses: actions/checkout@v4
1410

15-
- uses: actions/setup-java@v4
16-
with:
17-
java-version: '17'
18-
distribution: 'adopt'
11+
release:
12+
name: Create Release
13+
runs-on: ubuntu-latest
1914

20-
- name: Setup Gradle
21-
uses: gradle/actions/setup-gradle@v4
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
2218

23-
- name: Publish
24-
run: ./gradlew amuze:publish
19+
- name: Set release name
20+
run: echo ::set-env name=RELEASE_NAME::$(echo ${GITHUB_REF:11})
2521

22+
- name: Create Release
23+
id: create_release
24+
uses: actions/create-release@v1
2625
env:
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
with:
28+
tag_name: ${{ github.ref }}
29+
release_name: Amuze ${{ env.RELEASE_NAME }}
30+
body: |
31+
Initial release
32+
draft: false
33+
prerelease: false

amuze/build.gradle.kts

+39-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import com.android.ddmlib.Log
2+
import com.vanniktech.maven.publish.SonatypeHost
23
import java.net.URI
34

45
plugins {
56
alias(libs.plugins.android.library)
67
alias(libs.plugins.jetbrains.kotlin.android)
78
`maven-publish`
9+
alias(libs.plugins.com.vanniktech.maven.publish)
810
}
911

1012
android {
@@ -66,7 +68,7 @@ dependencies {
6668

6769
}
6870

69-
val ver = "1.0.0"
71+
val ver = "0.1.0"
7072
val id = "amuze"
7173

7274
publishing {
@@ -92,4 +94,40 @@ publishing {
9294
}
9395

9496
}
97+
}
98+
99+
mavenPublishing {
100+
101+
coordinates("com.infbyte", id, ver)
102+
103+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
104+
105+
signAllPublications()
106+
107+
pom {
108+
name.set("Amuze")
109+
description.set("Common functionality among media apps")
110+
inceptionYear.set("2024")
111+
url.set("https://github.com/shubertm/amuze")
112+
licenses {
113+
license {
114+
name.set("MIT License")
115+
url.set("https://opensource.org/license/mit")
116+
distribution.set("https://github.com/shubertm/Amuze/blob/main/LICENSE")
117+
}
118+
}
119+
developers {
120+
developer {
121+
id.set("shubertm")
122+
name.set("Shubert Munthali")
123+
url.set("https://github.com/shubertm/")
124+
}
125+
}
126+
127+
scm {
128+
url.set("https://github.com/shubertm/amuze")
129+
connection.set("scm:git:git://github.com/shubertm/amuze.git")
130+
developerConnection.set("scm:git:ssh://github.com/shubertm/amuze.git")
131+
}
132+
}
95133
}

gradle.properties

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Project-wide Gradle settings.
2+
# IDE (e.g. Android Studio) users:
3+
# Gradle settings configured through the IDE *will override*
4+
# any settings specified in this file.
5+
# For more details on how to configure your build environment visit
6+
# http://www.gradle.org/docs/current/userguide/build_environment.html
7+
# Specifies the JVM arguments used for the daemon process.
8+
# The setting is particularly useful for tweaking memory settings.
9+
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10+
# When configured, Gradle will run in incubating parallel mode.
11+
# This option should only be used with decoupled projects. For more details, visit
12+
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
13+
# org.gradle.parallel=true
14+
# AndroidX package structure to make it clearer which packages are bundled with the
15+
# Android operating system, and which are packaged with your app's APK
16+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
17+
android.useAndroidX=true
18+
# Kotlin code style for this project: "official" or "obsolete":
19+
kotlin.code.style=official
20+
# Enables namespacing of each library's R class so that its R class includes only the
21+
# resources declared in the library itself and none from the library's dependencies,
22+
# thereby reducing the size of the R class for that library
23+
android.nonTransitiveRClass=true

gradle/libs.versions.toml

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ activityCompose = "1.9.1"
1010
composeBom = "2024.04.01"
1111
appcompat = "1.7.0"
1212
material = "1.12.0"
13+
vMavenPublish = "0.29.0"
1314

1415
[libraries]
1516
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
@@ -33,3 +34,4 @@ material = { group = "com.google.android.material", name = "material", version.r
3334
android-application = { id = "com.android.application", version.ref = "agp" }
3435
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
3536
android-library = { id = "com.android.library", version.ref = "agp" }
37+
com-vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "vMavenPublish"}

0 commit comments

Comments
 (0)