Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/publish workflow #14

Merged
merged 6 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps:
# - Remove Old Draft Releases
# - Create New Draft Release
# The workflow is triggered on push to the main branch
#
# GitHub Actions reference: https://help.github.com/en/actions
#
on:
push:
branches:
- main

jobs:
main:
runs-on: ubuntu-latest
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3

# Set up Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

# Remove old release drafts by using the curl request for the available releases with a draft flag
- name: Remove Old Release Drafts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api repos/{owner}/{repo}/releases \
--jq '.[] | select(.draft == true) | .id' \
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}

# Create a new release draft which is not publicly visible and requires manual acceptance
- name: Create Release Draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ needs.build.outputs.version }} \
--draft \
--title "v${{ needs.build.outputs.version }}" \
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: publish to maven
on:
release:
types: [ created ]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 17

- name: publish to maven central
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache


41 changes: 41 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Collection of UI components and utilities for Jetpack Compose
- [x] Convention Plugins
- [ ] Sonarqube
- [x] CI/CD and PR validation, Spotless, Detekt, tests
- [ ] Release management, Maven Publish, Changelog, Tags & Releases
- [ ] Release management,
- [x] Maven Publish
- [ ] Changelog
- [ ] Tags & Releases
- [x] Documentation setup

1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
alias(libs.plugins.spotless)
alias(libs.plugins.detekt) apply false
alias(libs.plugins.kotlin.dokka)
alias(libs.plugins.gradle.maven.publish) apply false
}


Expand Down
24 changes: 23 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,26 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true

# POM values
GROUP=io.monstarlab.mosaic
VERSION_NAME=0.0.1-SNAPSHOT

POM_NAME=Mosaic
POM_DESCRIPTION=A collection of UI components.
POM_INCEPTION_YEAR=2024
POM_URL=https://github.com/monstar-lab-oss/android-mosaic

POM_LICENSE_NAME=MIT License
POM_LICENSE_URL=https://raw.githubusercontent.com/monstar-lab-oss/android-mosaic/main/LICENSE
POM_LICENSE_DIST=repo

POM_SCM_URL=scm:[email protected]:monstar-lab-oss/android-mosaic.git
POM_SCM_CONNECTION=scm:[email protected]:monstar-lab-oss/android-mosaic.git
POM_SCM_DEV_CONNECTION=scm:[email protected]:monstar-lab-oss/android-mosaic.git

POM_DEVELOPER_ID=Monstarlab
POM_DEVELOPER_NAME=Monstarlab
[email protected]
POM_DEVELOPER_URL=https://github.com/monstar-lab-oss
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ activityCompose = "1.8.2"
composeBom = "2024.02.00"
spotless="6.25.0"
detekt="1.23.5"
gradle-maven-publsih ="0.28.0"

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



12 changes: 12 additions & 0 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
import com.vanniktech.maven.publish.SonatypeHost

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.mosaic.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.gradle.maven.publish)

}

android {
Expand All @@ -20,6 +25,13 @@ android {
}
}
}
mavenPublishing {
configure(AndroidSingleVariantLibrary("release"))
publishToMavenCentral(SonatypeHost.S01)
signAllPublications()
}


kotlin {
jvmToolchain(17)
}
Expand Down
5 changes: 5 additions & 0 deletions lib/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
POM_NAME=Test Library
POM_DESCRIPTION=Test Library
POM_INCEPTION_YEAR=2024
POM_ARTIFACT_ID=lib
POM_PACKAGING=aar
Loading