feat: extract version from git tags for publish workflow #6
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 | |
| on: | |
| push: | |
| tags: ['runtime-v*', 'starter-v*', 'plugin-v*'] | |
| workflow_dispatch: | |
| inputs: | |
| module: | |
| description: 'Module to publish' | |
| required: true | |
| type: choice | |
| options: | |
| - runtime | |
| - starter | |
| - plugin | |
| jobs: | |
| runtime-maven-central: | |
| name: Publish Runtime to Maven Central | |
| if: ${{ startsWith(github.ref, 'refs/tags/runtime-v') || (github.event_name == 'workflow_dispatch' && inputs.module == 'runtime') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Make gradlew executable | |
| run: chmod +x gradlew | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/runtime-v* ]]; then | |
| echo "VERSION=${GITHUB_REF_NAME#runtime-v}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build | |
| run: ./gradlew :python-embed-runtime:build${{ steps.version.outputs.VERSION && format(' -PreleaseVersion={0}', steps.version.outputs.VERSION) || '' }} | |
| - name: Publish to Maven Central | |
| run: ./gradlew :python-embed-runtime:publishToMavenCentral --no-configuration-cache${{ steps.version.outputs.VERSION && format(' -PreleaseVersion={0}', steps.version.outputs.VERSION) || '' }} | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_IN_MEMORY_KEY_ID }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }} | |
| starter-maven-central: | |
| name: Publish Starter to Maven Central | |
| if: ${{ startsWith(github.ref, 'refs/tags/starter-v') || (github.event_name == 'workflow_dispatch' && inputs.module == 'starter') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Make gradlew executable | |
| run: chmod +x gradlew | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/starter-v* ]]; then | |
| echo "VERSION=${GITHUB_REF_NAME#starter-v}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build | |
| run: ./gradlew :python-embed-spring-boot-starter:build${{ steps.version.outputs.VERSION && format(' -PreleaseVersion={0}', steps.version.outputs.VERSION) || '' }} | |
| - name: Publish to Maven Central | |
| run: ./gradlew :python-embed-spring-boot-starter:publishToMavenCentral --no-configuration-cache${{ steps.version.outputs.VERSION && format(' -PreleaseVersion={0}', steps.version.outputs.VERSION) || '' }} | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_IN_MEMORY_KEY_ID }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }} | |
| gradle-plugin-portal: | |
| name: Publish to Gradle Plugin Portal | |
| if: ${{ startsWith(github.ref, 'refs/tags/plugin-v') || (github.event_name == 'workflow_dispatch' && inputs.module == 'plugin') }} | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: python-embed-gradle-plugin | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Make gradlew executable | |
| run: chmod +x gradlew | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| if [[ "$GITHUB_REF" == refs/tags/plugin-v* ]]; then | |
| echo "VERSION=${GITHUB_REF_NAME#plugin-v}" >> $GITHUB_OUTPUT | |
| else | |
| echo "VERSION=1.0.1" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build | |
| run: ./gradlew build -PreleaseVersion=${{ steps.version.outputs.VERSION }} | |
| - name: Publish to Gradle Plugin Portal | |
| run: ./gradlew publishPlugins -PreleaseVersion=${{ steps.version.outputs.VERSION }} | |
| env: | |
| GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} | |
| GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} |