Release #13
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: | |
| workflow_dispatch: | |
| inputs: | |
| ref: | |
| description: 'Git ref to build (branch name or SHA)' | |
| required: true | |
| type: string | |
| default: 'main' | |
| releaseLevel: | |
| description: 'Release level' | |
| required: true | |
| type: choice | |
| default: 'patch' | |
| options: | |
| - 'patch' # bug fixes | |
| - 'minor' # new features, backwards compatible | |
| - 'major' # breaking changes | |
| isPrerelease: | |
| description: 'Whether this is a prerelease' | |
| required: true | |
| type: boolean | |
| default: true | |
| prereleaseSuffix: | |
| description: 'Suffix to add onto the new version number in order to mark it as a prerelease. Value ignored when shipping a release that is not a prerelease.' | |
| required: false | |
| type: string | |
| default: 'rc1' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.event.inputs.ref }} | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '8' | |
| distribution: 'temurin' | |
| - name: Bump version | |
| run: | | |
| # Read current version | |
| CURRENT_VERSION=$(grep "pineconeClientVersion" gradle.properties | cut -d'=' -f2 | tr -d ' ') | |
| # Split version into components | |
| IFS='.' read -r major minor patch <<< "$CURRENT_VERSION" | |
| # Bump version based on release level | |
| case "${{ github.event.inputs.releaseLevel }}" in | |
| "major") | |
| NEW_VERSION="$((major + 1)).0.0" | |
| ;; | |
| "minor") | |
| NEW_VERSION="$major.$((minor + 1)).0" | |
| ;; | |
| "patch") | |
| NEW_VERSION="$major.$minor.$((patch + 1))" | |
| ;; | |
| esac | |
| # Append prerelease suffix if isPrerelease is true | |
| if [[ "${{ github.event.inputs.isPrerelease }}" == "true" ]]; then | |
| NEW_VERSION="$NEW_VERSION-${{ github.event.inputs.prereleaseSuffix }}" | |
| fi | |
| # Update gradle.properties | |
| sed -i "s/pineconeClientVersion = .*/pineconeClientVersion = $NEW_VERSION/" gradle.properties | |
| # Set output for later steps | |
| echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
| - name: Build with Gradle | |
| run: ./gradlew clean build | |
| - name: Stop daemon | |
| run: ./gradlew --stop | |
| - name: Echo New Version | |
| run: echo "New version is $NEW_VERSION" | |
| env: | |
| NEW_VERSION: ${{ env.NEW_VERSION }} | |
| - name: Publish to Maven Central | |
| env: | |
| ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} | |
| ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} | |
| ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} | |
| ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} | |
| ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} | |
| run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository |