Skip to content

Commit dd017b4

Browse files
authored
Merge pull request #14 from monstar-lab-oss/feat/publish_workflow
Feat/publish workflow
2 parents 3201056 + 553dc79 commit dd017b4

File tree

10 files changed

+151
-3
lines changed

10 files changed

+151
-3
lines changed

.github/workflows/main.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps:
2+
# - Remove Old Draft Releases
3+
# - Create New Draft Release
4+
# The workflow is triggered on push to the main branch
5+
#
6+
# GitHub Actions reference: https://help.github.com/en/actions
7+
#
8+
on:
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
main:
15+
runs-on: ubuntu-latest
16+
steps:
17+
# Check out current repository
18+
- name: Fetch Sources
19+
uses: actions/checkout@v3
20+
21+
# Set up Java environment for the next steps
22+
- name: Setup Java
23+
uses: actions/setup-java@v3
24+
with:
25+
distribution: zulu
26+
java-version: 17
27+
28+
# Remove old release drafts by using the curl request for the available releases with a draft flag
29+
- name: Remove Old Release Drafts
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
gh api repos/{owner}/{repo}/releases \
34+
--jq '.[] | select(.draft == true) | .id' \
35+
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
36+
37+
# Create a new release draft which is not publicly visible and requires manual acceptance
38+
- name: Create Release Draft
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
run: |
42+
gh release create v${{ needs.build.outputs.version }} \
43+
--draft \
44+
--title "v${{ needs.build.outputs.version }}" \

.github/workflows/publish.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: publish to maven
2+
on:
3+
release:
4+
types: [ created ]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v2
11+
- name: Setup Java
12+
uses: actions/setup-java@v1
13+
with:
14+
java-version: 17
15+
16+
- name: publish to maven central
17+
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
18+
19+

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Collection of UI components and utilities for Jetpack Compose
66
- [x] Convention Plugins
77
- [ ] Sonarqube
88
- [x] CI/CD and PR validation, Spotless, Detekt, tests
9-
- [ ] Release management, Maven Publish, Changelog, Tags & Releases
9+
- [ ] Release management,
10+
- [x] Maven Publish
11+
- [ ] Changelog
12+
- [ ] Tags & Releases
1013
- [x] Documentation setup
1114

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ plugins {
88
alias(libs.plugins.spotless)
99
alias(libs.plugins.detekt) apply false
1010
alias(libs.plugins.kotlin.dokka)
11+
alias(libs.plugins.gradle.maven.publish) apply false
1112
}
1213

1314

gradle.properties

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,26 @@ kotlin.code.style=official
2020
# Enables namespacing of each library's R class so that its R class includes only the
2121
# resources declared in the library itself and none from the library's dependencies,
2222
# thereby reducing the size of the R class for that library
23-
android.nonTransitiveRClass=true
23+
android.nonTransitiveRClass=true
24+
25+
# POM values
26+
GROUP=io.monstarlab.mosaic
27+
VERSION_NAME=0.0.1-SNAPSHOT
28+
29+
POM_NAME=Mosaic
30+
POM_DESCRIPTION=A collection of UI components.
31+
POM_INCEPTION_YEAR=2024
32+
POM_URL=https://github.com/monstar-lab-oss/android-mosaic
33+
34+
POM_LICENSE_NAME=MIT License
35+
POM_LICENSE_URL=https://raw.githubusercontent.com/monstar-lab-oss/android-mosaic/main/LICENSE
36+
POM_LICENSE_DIST=repo
37+
38+
POM_SCM_URL=scm:[email protected]:monstar-lab-oss/android-mosaic.git
39+
POM_SCM_CONNECTION=scm:[email protected]:monstar-lab-oss/android-mosaic.git
40+
POM_SCM_DEV_CONNECTION=scm:[email protected]:monstar-lab-oss/android-mosaic.git
41+
42+
POM_DEVELOPER_ID=Monstarlab
43+
POM_DEVELOPER_NAME=Monstarlab
44+
POM_DEVELOPER_EMAIL=[email protected]
45+
POM_DEVELOPER_URL=https://github.com/monstar-lab-oss

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ activityCompose = "1.8.2"
1010
composeBom = "2024.02.00"
1111
spotless="6.25.0"
1212
detekt="1.23.5"
13+
gradle-maven-publsih ="0.28.0"
1314

1415
[libraries]
1516
android_gradle_plugin = { module = "com.android.tools.build:gradle", version.ref = "agp" }
@@ -38,6 +39,7 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
3839
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "kotlin" }
3940
mosaic-application = { id = "io.monstarlab.mosaic.application", version = "undefined" }
4041
mosaic-library = { id = "io.monstarlab.mosaic.library", version = "undefined" }
42+
gradle-maven-publish = {id = "com.vanniktech.maven.publish", version.ref = "gradle-maven-publsih"}
4143

4244

4345

lib/build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
2+
import com.vanniktech.maven.publish.SonatypeHost
3+
14
plugins {
25
alias(libs.plugins.android.library)
36
alias(libs.plugins.mosaic.library)
47
alias(libs.plugins.kotlin.android)
8+
alias(libs.plugins.gradle.maven.publish)
9+
510
}
611

712
android {
@@ -20,6 +25,13 @@ android {
2025
}
2126
}
2227
}
28+
mavenPublishing {
29+
configure(AndroidSingleVariantLibrary("release"))
30+
publishToMavenCentral(SonatypeHost.S01)
31+
signAllPublications()
32+
}
33+
34+
2335
kotlin {
2436
jvmToolchain(17)
2537
}

lib/gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
POM_NAME=Test Library
2+
POM_DESCRIPTION=Test Library
3+
POM_INCEPTION_YEAR=2024
4+
POM_ARTIFACT_ID=lib
5+
POM_PACKAGING=aar

0 commit comments

Comments
 (0)