Enforce iOS compile in CI and fix NeutralColor multiplatform build (#18) #9
Workflow file for this run
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 Central | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: 'Dry run (skip actual publish)' | |
| required: false | |
| default: 'false' | |
| type: boolean | |
| permissions: | |
| contents: write | |
| jobs: | |
| publish: | |
| name: Publish to Maven Central | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Validate tag version | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| TAG_VERSION="${GITHUB_REF#refs/tags/v}" | |
| GRADLE_VERSION=$(grep '^phosphorVersion=' gradle.properties | cut -d'=' -f2) | |
| if [ "$TAG_VERSION" != "$GRADLE_VERSION" ]; then | |
| echo "Error: Tag version ($TAG_VERSION) does not match gradle.properties ($GRADLE_VERSION)" | |
| exit 1 | |
| fi | |
| echo "Version validated: $TAG_VERSION" | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'zulu' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Run tests before publish | |
| run: ./gradlew :phosphor-core:jvmTest :phosphor-core:compileKotlinIosArm64 | |
| - name: Decode signing key | |
| if: ${{ github.event.inputs.dry_run != 'true' }} | |
| env: | |
| SIGNING_KEY_BASE64: ${{ secrets.SIGNING_KEY }} | |
| run: echo "$SIGNING_KEY_BASE64" | base64 -d > /tmp/signing-key.asc | |
| - name: Publish to Maven Central | |
| if: ${{ github.event.inputs.dry_run != 'true' }} | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} | |
| run: | | |
| export ORG_GRADLE_PROJECT_signingInMemoryKey="$(cat /tmp/signing-key.asc)" | |
| ./gradlew :phosphor-core:publishAllPublicationsToMavenCentralRepository | |
| - name: Dry run publish | |
| if: ${{ github.event.inputs.dry_run == 'true' }} | |
| run: | | |
| echo "Dry run mode - publishing to Maven Local only" | |
| ./gradlew :phosphor-core:publishToMavenLocal | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/v') && github.event.inputs.dry_run != 'true' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| draft: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |