diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml index 1d6c2d8..084f4b2 100644 --- a/.github/workflows/on-push.yml +++ b/.github/workflows/on-push.yml @@ -96,7 +96,7 @@ jobs: - name: Build ${{ matrix.project }} Release run: ./gradlew ${{ matrix.gradle-arguments }} - # Push the Library to Github packages + # On release/main, push build to Github packages - name: Publish Release if: matrix.project == 'Library' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) env: @@ -105,6 +105,15 @@ jobs: run: | ./gradlew publishReleaseAarPublicationToGitHubPackagesRepository + # On other branches, push snapshot to Github packages + - name: Publish Snapshot + if: matrix.project == 'Library' && !(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) + env: + GITHUB_USERNAME: ${{ github.actor }} + GITHUB_PASSWORD: ${{ github.token }} + run: | + ./gradlew publishReleaseSnapshotAarPublicationToGitHubPackagesRepository + # Upload the AAR file as a build artifact (accessible from the Summary page of the run) - name: Upload AAR file uses: actions/upload-artifact@v2 diff --git a/Armadillo/build.gradle b/Armadillo/build.gradle index a0b6ede..f560e51 100644 --- a/Armadillo/build.gradle +++ b/Armadillo/build.gradle @@ -84,7 +84,7 @@ publishing { publications { android.libraryVariants.all { variant -> - "${variant.name.capitalize()}Aar"(MavenPublication) { + "${variant.name.capitalize()}Aar" (MavenPublication) { from(components[variant.name]) groupId project.PACKAGE_NAME version project.LIBRARY_VERSION @@ -95,6 +95,19 @@ publishing { artifact androidJavadocsJar } } + + android.libraryVariants.all { variant -> + "${variant.name.capitalize()}SnapshotAar" (MavenPublication) { + from(components[variant.name]) + groupId project.PACKAGE_NAME + version "${project.LIBRARY_VERSION}-SNAPSHOT" + artifactId project.getName().toLowerCase() + // Add sources to artifact + artifact androidSourcesJar + // Add javadocs + artifact androidJavadocsJar + } + } } repositories {