-
Notifications
You must be signed in to change notification settings - Fork 13
Automate release process #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
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 | ||
|
||
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 | ||
|
||
# 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: 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 | ||
|
||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: Release v${{ env.NEW_VERSION }} | ||
tag_name: v${{ env.NEW_VERSION }} | ||
body: | | ||
Release v${{ env.NEW_VERSION }} | ||
|
||
This release was created automatically by the release workflow. | ||
draft: false | ||
prerelease: false | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.