diff --git a/.github/workflows/library.yml b/.github/workflows/library.yml index 5012e548..fa09ebbc 100644 --- a/.github/workflows/library.yml +++ b/.github/workflows/library.yml @@ -6,12 +6,14 @@ name: Library Snapshot Release on: push: tags: - - library v[0-9]+.[0-9]+.[0-9]+-SNAPSHOT - - library v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+-SNAPSHOT - - library v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+-[0-9a-zA-Z]+-SNAPSHOT + - library-v[0-9]+.[0-9]+.[0-9]+-SNAPSHOT + - library-v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+-SNAPSHOT + - library-v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+-[0-9a-zA-Z]+-SNAPSHOT env: OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + GITHUB_USERNAME: ${{ github.actor }} + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: release: @@ -41,6 +43,9 @@ jobs: - name: Generate & upload library snapshot artifact AAR (Android Archive) file run: ./gradlew :library:clean --stacktrace && ./gradlew :library:assembleRelease --stacktrace && ./gradlew :library:publishMavenJavaPublicationToMavenCentralRepository --stacktrace + - name: Generate & upload library snapshot artifact AAR (Android Archive) file to Github Packages + run: ./gradlew :library:publishMavenJavaPublicationToGithubPackagesRepository --stacktrace + - name: Github Release uses: softprops/action-gh-release@v1 with: diff --git a/.github/workflows/utils.yml b/.github/workflows/utils.yml index aee7b49a..e4d1a0f4 100644 --- a/.github/workflows/utils.yml +++ b/.github/workflows/utils.yml @@ -1,17 +1,19 @@ # This workflow will build a Java project with Gradle # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle -name: Library Snapshot Release +name: Utils Snapshot Release on: push: tags: - - utils v[0-9]+.[0-9]+.[0-9]+-SNAPSHOT - - utils v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+-SNAPSHOT - - utils v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+-[0-9a-zA-Z]+-SNAPSHOT + - utils-v[0-9]+.[0-9]+.[0-9]+-SNAPSHOT + - utils-v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+-SNAPSHOT + - utils-v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+-[0-9a-zA-Z]+-SNAPSHOT env: OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + GITHUB_USERNAME: ${{ github.actor }} + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: release: @@ -31,16 +33,40 @@ jobs: uses: actions/setup-java@v1 with: java-version: 11 - + + - name: Create local.properties file + run: touch local.properties && echo "mapbox.repo.token=${{ secrets.MAPBOX_SDK_REPO_TOKEN }}" >> local.properties + + - name: Print Java version + run: java -version + - name: Grant execute permission for gradlew run: chmod +x gradlew - - - name: Run unit tests with Gradle - run: ./gradlew :utils:clean :utils:testDebugUnitTest --stacktrace - - name: Generate & upload library snapshot artifact AAR (Android Archive) file + - name: Git show commit count + run: git fetch origin master && git rev-list --first-parent --count origin/master + + - name: Download Robolectric deps + run: chmod +x download-robolectric-deps.sh && ./download-robolectric-deps.sh + + - name: Clean project + run: ./gradlew clean --stacktrace + + - name: Build project skipping tests + run: ./gradlew build -x test --stacktrace + + - name: Run Instrumented Tests manually + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 22 + script: ./gradlew :utils:connectedDebug --stacktrace + + - name: Generate & upload utils snapshot artifact AAR (Android Archive) file to Sonatype run: ./gradlew :utils:clean --stacktrace && ./gradlew :utils:assembleRelease --stacktrace && ./gradlew :utils:publishMavenJavaPublicationToMavenCentralRepository --stacktrace + - name: Generate & upload utils snapshot artifact AAR (Android Archive) file to Github Packages + run: ./gradlew :utils:publishMavenJavaPublicationToGithubPackagesRepository --stacktrace + - name: Github Release uses: softprops/action-gh-release@v1 with: diff --git a/publish.gradle b/publish.gradle index f7ecc0d1..c6a5ecc6 100644 --- a/publish.gradle +++ b/publish.gradle @@ -36,11 +36,11 @@ def getOSSRHRepositoryUsername() { } def getGithubPublishUsername() { - return hasProperty('githubUsername') ? githubUsername: "" + return hasProperty('githubUsername') ? githubUsername : System.getenv("GITHUB_USERNAME") != null ? System.getenv("GITHUB_USERNAME") : "" } def getGithubPackagesAccessToken() { - return hasProperty('githubAccessToken') ? githubAccessToken: "" + return hasProperty('githubAccessToken') ? githubAccessToken : System.getenv("GITHUB_ACCESS_TOKEN") != null ? System.getenv("GITHUB_ACCESS_TOKEN") : "" } def getDate() { @@ -163,10 +163,11 @@ publishing { } signing { + required !version.contains("SNAPSHOT") sign(publishing.publications['mavenJava']) } artifacts { archives sourceJar archives javadocJar -} \ No newline at end of file +} diff --git a/utils/build.gradle b/utils/build.gradle index 2dce714d..581f9dd6 100644 --- a/utils/build.gradle +++ b/utils/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'com.jfrog.bintray' apply plugin: 'maven-publish' apply plugin: 'jacoco' -version '0.9.0' +version '0.9.1-PUBT-SNAPSHOT' project.version = this.version