Skip to content

Commit

Permalink
[APT-9571] Build snapshot version on push to non-main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
kschults committed Nov 27, 2023
1 parent 4461b8d commit 8586de9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
15 changes: 14 additions & 1 deletion Armadillo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit 8586de9

Please sign in to comment.