Publish to Maven #108
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to Maven | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| repo-gcloud: | |
| type: boolean | |
| description: "Repository: GCloud" | |
| default: true | |
| repo-mavencentral: | |
| type: boolean | |
| description: "Repository: Maven Central" | |
| default: true | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| # See: https://vanniktech.github.io/gradle-maven-publish-plugin/central/#secrets | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.VARABYTE_SIGNING_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.VARABYTE_SIGNING_KEY_ID }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.VARABYTE_SIGNING_PASSWORD }} | |
| strategy: | |
| matrix: | |
| # Note: We use macos since it can build mac, linux, and windows targets. ubuntu is faster but cannot build mac | |
| # artifacts. | |
| os: [macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Java 17 needed for resolving the Android Gradle Plugin | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Add secret Gradle properties | |
| env: | |
| GRADLE_PROPERTIES: ${{ secrets.VARABYTE_GRADLE_PROPERTIES }} | |
| shell: bash | |
| run: | | |
| mkdir -p ~/.gradle/ | |
| echo "GRADLE_USER_HOME=${HOME}/.gradle" >> $GITHUB_ENV | |
| echo "${GRADLE_PROPERTIES}" > ~/.gradle/gradle.properties | |
| - name: Cache Kotlin Native compiler | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.konan | |
| key: kotlin-native-compiler-${{ runner.OS }} | |
| - name: Publish GCloud | |
| if: inputs.repo-gcloud | |
| run: | | |
| ./gradlew publishAllPublicationsToGCloudMavenRepository | |
| - name: Publish Maven Central | |
| if: inputs.repo-mavencentral | |
| run: | | |
| ./gradlew publishAllPublicationsToMavenCentralRepository |