Publish Release #6
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 Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| module: | |
| description: 'Module to publish' | |
| required: false | |
| type: choice | |
| default: all | |
| options: | |
| - all | |
| - maestro-utils | |
| - maestro-client | |
| - maestro-ios | |
| - maestro-orchestra | |
| - maestro-orchestra-models | |
| - maestro-proto | |
| - maestro-ios-driver | |
| - maestro-ai | |
| - maestro-web | |
| - maestro-cli | |
| auto_release: | |
| description: 'Automatically release the Maven Central deployment after upload' | |
| required: false | |
| type: boolean | |
| default: true | |
| push: | |
| tags: | |
| - 'v*' | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ vars.MAVEN_CENTRAL_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_IN_MEMORY_KEY_ID }} | |
| PUBLISH_MODULE: ${{ github.event_name == 'workflow_dispatch' && inputs.module || 'all' }} | |
| AUTO_RELEASE: ${{ github.event_name != 'workflow_dispatch' || inputs.auto_release }} | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'Entertech/Maestro' | |
| steps: | |
| - name: Clone repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: zulu | |
| java-version: 17 | |
| cache: gradle | |
| - name: Retrieve version | |
| run: | | |
| echo "VERSION_NAME=$(cat gradle.properties | grep -w "VERSION_NAME" | cut -d'=' -f2)" >> $GITHUB_ENV | |
| - name: Publish Maven Central release | |
| run: | | |
| if [[ "$VERSION_NAME" == *"-SNAPSHOT" ]]; then | |
| echo "Skipping Maven Central release for snapshot version $VERSION_NAME" | |
| exit 0 | |
| fi | |
| case "$PUBLISH_MODULE" in | |
| all) | |
| modules=( | |
| maestro-utils | |
| maestro-client | |
| maestro-ios | |
| maestro-orchestra | |
| maestro-orchestra-models | |
| maestro-proto | |
| maestro-ios-driver | |
| maestro-ai | |
| maestro-web | |
| maestro-cli | |
| ) | |
| ;; | |
| maestro-utils|maestro-client|maestro-ios|maestro-orchestra|maestro-orchestra-models|maestro-proto|maestro-ios-driver|maestro-ai|maestro-web|maestro-cli) | |
| modules=("$PUBLISH_MODULE") | |
| ;; | |
| *) | |
| echo "Unsupported module: $PUBLISH_MODULE" | |
| exit 1 | |
| ;; | |
| esac | |
| if [[ "$AUTO_RELEASE" == "true" ]]; then | |
| publish_task="publishAndReleaseToMavenCentral" | |
| else | |
| publish_task="publishToMavenCentral" | |
| fi | |
| tasks=() | |
| for module in "${modules[@]}"; do | |
| tasks+=(":$module:$publish_task") | |
| done | |
| ./gradlew clean "${tasks[@]}" --no-daemon --no-parallel | |
| env: | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }} | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ env.ORG_GRADLE_PROJECT_mavenCentralUsername }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ env.ORG_GRADLE_PROJECT_mavenCentralPassword }} |