From f793660001095a0aa0f0ff9616085d52a7f62d13 Mon Sep 17 00:00:00 2001 From: Saif Khan Date: Sun, 26 Jun 2022 15:21:56 +0200 Subject: [PATCH] Added workflow to automaticall publish releases to maven central, removed bintray. --- .github/workflows/publish.yml | 38 ++++++++++++++++++++++++++++ build.gradle | 8 +++++- tiles/build.gradle | 47 ++++++++++++++++------------------- 3 files changed, 66 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a7d58a5 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,38 @@ +name: Publish + +on: + release: + # We'll run this workflow when a new GitHub release is created + types: [ released ] + +jobs: + publish: + name: Release build and publish + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + distribution: adopt + java-version: 11 + + # Builds the release artifacts of the library + - name: Release build + run: ./gradlew :tiles:assembleRelease + + # Generates other artifacts + - name: Source jar and dokka + run: ./gradlew androidSourcesJar + + # Runs upload, and then closes & releases the repository + - name: Publish to MavenCentral + run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository + env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} + SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 4cde600..7653fa4 100755 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,10 @@ buildscript { } } +plugins { + id("io.github.gradle-nexus.publish-plugin") version "1.1.0" +} + allprojects { repositories { jcenter() @@ -28,4 +32,6 @@ allprojects { options.addStringOption('Xdoclint:none', '-quiet') options.addStringOption('encoding', 'UTF-8') } -} \ No newline at end of file +} + +apply from: 'https://raw.githubusercontent.com/saifkhichi96/template-files/main/android/gradle/publish-root.gradle' \ No newline at end of file diff --git a/tiles/build.gradle b/tiles/build.gradle index 713b9b8..571b7a4 100755 --- a/tiles/build.gradle +++ b/tiles/build.gradle @@ -38,32 +38,27 @@ tasks.withType(Javadoc) { options.addStringOption('charSet', 'UTF-8') } -// For Bintray and JCenter distribution +// for maven central distribution ext { - bintrayRepo = 'maven' - bintrayName = 'tiled' - - publishedGroupId = 'dev.aspirasoft.apis' - libraryName = 'Tiled' - artifact = 'tiled' - - libraryDescription = 'A lightweight library for creating simple tilemap-based UIs in Android.' - - siteUrl = 'https://github.com/saifkhichi96/tiled' - gitUrl = 'https://github.com/saifkhichi96/tiled.git' - - libraryVersion = '0.0.1' - - developerId = 1 - developerName = 'Muhammad Saif Ullah Khan' - developerEmail = 'saifkhichi96@gmail.com' - organization = 'saifkhichi96' - licenseName = 'MIT License' - licenseUrl = 'https://opensource.org/licenses/MIT' - allLicenses = ["MIT"] + PUBLISH_GROUP_ID = 'dev.aspirasoft.apis' + PUBLISH_VERSION = '0.0.1' + PUBLISH_ARTIFACT_ID = 'tiled' + PUBLISH_ARTIFACT_DESC = 'A lightweight library for creating simple tilemap-based UIs in Android.' + PUBLISH_ARTIFACT_URL = 'https://github.com/aspirasoft/tiled' + PUBLISH_ARTIFACT_LICENSE = { + name = 'MIT License' + url = 'https://github.com/aspirasoft/tiled/blob/master/LICENSE' + } + PUBLISH_ARTIFACT_AUTHOR = { + id = 'saifkhichi96' + name = 'Saif Khan' + email = 'saifkhichi96@gmail.com' + } + PUBLISH_ARTIFACT_VCS = { + connection = 'scm:git:github.com/aspirasoft/tiled.git' + developerConnection = 'scm:git:ssh://github.com/aspirasoft/tiled.git' + url = 'https://github.com/aspirasoft/tiled/tree/master' + } } - -// Bintray configuration -apply from: 'https://raw.githubusercontent.com/quangctkm9207/template-files/master/android/gradle/install.gradle' -apply from: 'https://raw.githubusercontent.com/quangctkm9207/template-files/master/android/gradle/bintray.gradle' \ No newline at end of file +apply from: 'https://raw.githubusercontent.com/saifkhichi96/template-files/main/android/gradle/publish-module.gradle' \ No newline at end of file