From 9a0bb3b1ba3c74f0db3dcf8586b928ecfd98e903 Mon Sep 17 00:00:00 2001 From: Thomas Gorisse Date: Fri, 4 Aug 2023 17:23:45 +0200 Subject: [PATCH] Added GitHub Actions --- .github/workflows/build-check.yml | 29 ++++++++++++++++++ .github/workflows/close-issues-and-pr.yml | 18 ++++++++++++ .github/workflows/publish-release.yml | 30 +++++++++++++++++++ .github/workflows/upload-release.yml | 36 +++++++++++++++++++++++ build.gradle | 11 ++++++- core/build.gradle | 5 +++- sceneform/build.gradle | 5 +++- ux/build.gradle | 5 +++- 8 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build-check.yml create mode 100644 .github/workflows/close-issues-and-pr.yml create mode 100644 .github/workflows/publish-release.yml create mode 100644 .github/workflows/upload-release.yml diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml new file mode 100644 index 00000000..a4c07460 --- /dev/null +++ b/.github/workflows/build-check.yml @@ -0,0 +1,29 @@ +name: Build Check + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + build: + name: Debug build + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + distribution: adopt + java-version: 17 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Build library + run: ./gradlew assembleDebug --stacktrace \ No newline at end of file diff --git a/.github/workflows/close-issues-and-pr.yml b/.github/workflows/close-issues-and-pr.yml new file mode 100644 index 00000000..993089cc --- /dev/null +++ b/.github/workflows/close-issues-and-pr.yml @@ -0,0 +1,18 @@ +name: 'Close stale issues and PRs' +on: + schedule: + - cron: '30 5 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v4 + with: + close-issue-message: 'Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.' + stale-issue-message: 'Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.' + days-before-stale: 90 + days-before-close: 7 + enable-statistics: true + operations-per-run: 60 + exempt-issue-labels: 'acknowledged,needs-triage' \ No newline at end of file diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 00000000..81067fc7 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,30 @@ +name: Publish Release To Maven Central + +on: + # Run this workflow when a new GitHub release is created + # release: + # types: [ released ] + workflow_dispatch: + +jobs: + publish: + name: Release build and publish + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + distribution: adopt + java-version: 17 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Publish release + run: ./gradlew closeAndReleaseRepository --no-daemon --no-parallel + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/upload-release.yml b/.github/workflows/upload-release.yml new file mode 100644 index 00000000..e6e71b05 --- /dev/null +++ b/.github/workflows/upload-release.yml @@ -0,0 +1,36 @@ +name: Upload release to Sonatype Staging Repository + +# Run this workflow when a tag is pushed +on: + push: + tags: + - '*' + workflow_dispatch: + +jobs: + publish: + name: Release build and updload + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + distribution: adopt + java-version: 17 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Upload release to Sonatype Staging Repository + run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + #SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} + #SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} + #SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 824ab275..9997d458 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,8 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:7.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0' + // Maven Central Publish + classpath "com.vanniktech:gradle-maven-publish-plugin:0.18.0" } } @@ -41,6 +42,14 @@ allprojects { } } +allprojects { + plugins.withId("com.vanniktech.maven.publish") { + mavenPublish { +// sonatypeHost = "S01" + } + } +} + task printProjectProperties { project.properties.each { println " $it" } } diff --git a/core/build.gradle b/core/build.gradle index a643dc67..bfcf92bd 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,9 +1,12 @@ plugins { id 'com.android.library' id 'kotlin-android' -// id 'com.vanniktech.maven.publish' + id 'com.vanniktech.maven.publish' } +group = GROUP +version = VERSION_NAME + android { compileSdk rootProject.ext.compileSdk compileSdkVersion rootProject.ext.compileSdk diff --git a/sceneform/build.gradle b/sceneform/build.gradle index bbd14bcb..f2680f4f 100644 --- a/sceneform/build.gradle +++ b/sceneform/build.gradle @@ -1,9 +1,12 @@ plugins { id 'com.android.library' id 'kotlin-android' -// id 'com.vanniktech.maven.publish' + id 'com.vanniktech.maven.publish' } +group = GROUP +version = VERSION_NAME + android { compileSdk rootProject.ext.compileSdk compileSdkVersion rootProject.ext.compileSdk diff --git a/ux/build.gradle b/ux/build.gradle index 6ba2f05b..cea4778e 100644 --- a/ux/build.gradle +++ b/ux/build.gradle @@ -1,9 +1,12 @@ plugins { id 'com.android.library' id 'kotlin-android' -// id 'com.vanniktech.maven.publish' + id 'com.vanniktech.maven.publish' } +group = GROUP +version = VERSION_NAME + android { compileSdk rootProject.ext.compileSdk compileSdkVersion rootProject.ext.compileSdk