Skip to content

Commit

Permalink
Accept extra maven repositories as project setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ViliusSutkus89 committed Nov 9, 2023
1 parent 055fdc2 commit 2fac102
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
description: 'Package version'
default: ''
required: false
EXTRA_REPOSITORIES:
description: 'Extra maven repositories to find dependencies'
default: ''
required: false

env:
REPO_DESCRIPTION: ${{ inputs.PACKAGE }}-${{ inputs.VERSION }}-${{ github.run_id }}-${{ github.run_attempt }}
Expand Down Expand Up @@ -61,7 +65,7 @@ jobs:

- uses: actions/checkout@v4

- run: ./gradlew ${{ inputs.PACKAGE }}:publishToMavenLocal -PpackageVersion=${{ inputs.VERSION }} -PndkPath=${{ env.ANDROID_SDK_ROOT }}/ndk/${{ matrix.ndk }} -PlibraryType=${{ matrix.libraryType }}
- run: ./gradlew ${{ inputs.PACKAGE }}:publishToMavenLocal -PpackageVersion=${{ inputs.VERSION }} -PndkPath=${{ env.ANDROID_SDK_ROOT }}/ndk/${{ matrix.ndk }} -PlibraryType=${{ matrix.libraryType }} -PextraRepositories="${{ github.event.inputs.EXTRA_REPOSITORIES }}"

- uses: actions/upload-artifact@v3
with:
Expand All @@ -75,7 +79,7 @@ jobs:
path: ~/.m2
if-no-files-found: error

- run: ./gradlew -PrepoDescription=${{ env.REPO_DESCRIPTION }} findSonatypeStagingRepository -x initializeSonatypeStagingRepository ${{ inputs.PACKAGE }}:publishToSonatype -PpackageVersion=${{ inputs.VERSION }} -PndkPath=${{ env.ANDROID_SDK_ROOT }}/ndk/${{ matrix.ndk }} -PlibraryType=${{ matrix.libraryType }}
- run: ./gradlew -PrepoDescription=${{ env.REPO_DESCRIPTION }} findSonatypeStagingRepository -x initializeSonatypeStagingRepository ${{ inputs.PACKAGE }}:publishToSonatype -PpackageVersion=${{ inputs.VERSION }} -PndkPath=${{ env.ANDROID_SDK_ROOT }}/ndk/${{ matrix.ndk }} -PlibraryType=${{ matrix.libraryType }} -PextraRepositories="${{ github.event.inputs.EXTRA_REPOSITORIES }}"
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
Expand Down
6 changes: 6 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ pluginManagement {
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
repositories {
val extraRepositories: String? by settings
extraRepositories?.split(" ")?.forEach {
maven {
url = java.net.URI("https://oss.sonatype.org/service/local/repositories/comviliussutkus89-${it}/content/")
}
}
mavenCentral()
}
}
Expand Down

0 comments on commit 2fac102

Please sign in to comment.