trigger-release #52
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: release | |
| on: | |
| repository_dispatch: | |
| types: [ trigger-release ] | |
| workflow_dispatch: | |
| inputs: | |
| stableVersion: | |
| description: "Stable release version (e.g., 1.8.0)" | |
| required: true | |
| betaVersion: | |
| description: "Beta release version (e.g., 1.8.0-beta15)" | |
| required: true | |
| env: | |
| STABLE_VERSION: ${{ github.event.inputs.stableVersion || github.event.client_payload.stableVersion }} | |
| BETA_VERSION: ${{ github.event.inputs.betaVersion || github.event.client_payload.betaVersion }} | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| lfs: true | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: maven | |
| server-id: central | |
| server-username: MAVEN_CENTRAL_USERNAME | |
| server-password: MAVEN_CENTRAL_PASSWORD | |
| gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
| gpg-passphrase: GPG_PASSPHRASE | |
| - name: Show inputs | |
| run: | | |
| echo "Stable version: ${{ env.STABLE_VERSION }}" | |
| echo "Beta version: ${{ env.BETA_VERSION }}" | |
| - name: Create release branch | |
| run: | | |
| git checkout -b release-${{ env.BETA_VERSION }} | |
| - name: Extract current stable SNAPSHOT version from POM property | |
| id: extract-stable-snapshot-version | |
| run: | | |
| REVISION=$(mvn help:evaluate -Dexpression=langchain4j.stable.version -q -DforceStdout) | |
| echo "stableVersionSnapshot=$REVISION" >> $GITHUB_OUTPUT | |
| - name: Update stable versions | |
| run: mvn versions:set -DnewVersion=${{ env.STABLE_VERSION }} -DoldVersion=${{ steps.extract-stable-snapshot-version.outputs.stableVersionSnapshot }} -DgroupId=* -DartifactId=* -DgenerateBackupPoms=false | |
| - name: Update stable version property | |
| run: mvn versions:set-property -Dproperty=langchain4j.stable.version -DnewVersion=${{ env.STABLE_VERSION }} | |
| - name: Extract current beta SNAPSHOT version from POM property | |
| id: extract-beta-snapshot-version | |
| run: | | |
| REVISION=$(mvn help:evaluate -Dexpression=langchain4j.beta.version -q -DforceStdout) | |
| echo "betaVersionSnapshot=$REVISION" >> $GITHUB_OUTPUT | |
| - name: Update beta versions | |
| run: mvn versions:set -DnewVersion=${{ env.BETA_VERSION }} -DoldVersion=${{ steps.extract-beta-snapshot-version.outputs.betaVersionSnapshot }} -DgroupId=* -DartifactId=* -DgenerateBackupPoms=false | |
| - name: Update beta version property | |
| run: mvn versions:set-property -Dproperty=langchain4j.beta.version -DnewVersion=${{ env.BETA_VERSION }} | |
| - name: release_part_1 # Maven Central allows uploading archive up to 1GB, so we need to split release in 2 parts | |
| run: | | |
| mvn -B -U --fail-at-end \ | |
| -pl !langchain4j-embeddings-bge-small-zh-q,!langchain4j-embeddings-bge-small-zh-v15-q,!langchain4j-embeddings-bge-small-zh-v15,!langchain4j-embeddings-bge-small-zh \ | |
| -Psign clean deploy | |
| env: | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| - name: release_part_2 # Maven Central allows uploading archive up to 1GB, so we need to split release in 2 parts | |
| run: | | |
| mvn -B -U --fail-at-end \ | |
| -pl langchain4j-embeddings-bge-small-zh-q,langchain4j-embeddings-bge-small-zh-v15-q,langchain4j-embeddings-bge-small-zh-v15,langchain4j-embeddings-bge-small-zh \ | |
| -Psign clean deploy | |
| env: | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| - name: Commit version changes | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "Release versions ${{ env.STABLE_VERSION }} and ${{ env.BETA_VERSION }}" | |
| - name: Push release branch | |
| run: | | |
| git push origin release-${{ env.BETA_VERSION }} | |
| - name: Tag release | |
| run: | | |
| git tag ${{ env.BETA_VERSION }} | |
| git push origin ${{ env.BETA_VERSION }} | |
| - name: Trigger release in the langchain4j/langchain4j repo | |
| uses: peter-evans/repository-dispatch@v4 | |
| with: | |
| token: ${{ secrets.GH_RELEASE_AUTOMATION_PAT }} | |
| repository: langchain4j/langchain4j | |
| event-type: trigger-release | |
| client-payload: | | |
| { | |
| "stableVersion": "${{ env.STABLE_VERSION }}", | |
| "betaVersion": "${{ env.BETA_VERSION }}" | |
| } |