-
Notifications
You must be signed in to change notification settings - Fork 59
Add github release action & migrate ossrh to central publishing #66
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,97 @@ | ||
name: Publish release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
JAVA_VERSION: ${{ vars.JAVA_VERSION }} | ||
JAVA_DISTRIBUTION: ${{ vars.JAVA_DISTRIBUTION }} | ||
MAVEN_OPTS: ${{ vars.MAVEN_OPTS }} | ||
GPG_KEY_FILE: /tmp/gpg-key.txt | ||
|
||
jobs: | ||
publish-release: | ||
runs-on: ubuntu-latest | ||
environment: release | ||
strategy: | ||
fail-fast: true | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Check branch | ||
if: ${{ github.ref != 'refs/heads/master' }} | ||
run: echo "Invalid branch. This action can only be run on the master branch." && exit 1 | ||
|
||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.PRESTODB_CI_TOKEN }} | ||
show-progress: false | ||
fetch-depth: 0 | ||
ref: master | ||
|
||
- name: Set up JDK ${{ env.JAVA_DISTRIBUTION }}/${{ env.JAVA_VERSION }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ env.JAVA_VERSION }} | ||
distribution: ${{ env.JAVA_DISTRIBUTION }} | ||
overwrite-settings: true | ||
server-id: ossrh | ||
server-username: NEXUS_USERNAME | ||
server-password: NEXUS_PASSWORD | ||
gpg-private-key: ${{ secrets.GPG_SECRET }} | ||
|
||
- name: Set up git | ||
run: | | ||
git config --global --add safe.directory ${{github.workspace}} | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "prestodb-ci" | ||
git config --global alias.ls 'log --pretty=format:"%cd %h %ce: %s" --date=short --no-merges' | ||
git config pull.rebase false | ||
|
||
- name: Get release version | ||
id: get-version | ||
run: | | ||
RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | tail -n 1 | sed 's/-SNAPSHOT//') | ||
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | ||
echo "RELEASE_VERSION=$RELEASE_VERSION" | ||
echo "In case cut release failed, please delete the tag ${RELEASE_VERSION} manually" | ||
|
||
- name: Prepare release | ||
run: | | ||
git reset --hard | ||
mvn release:prepare -DreleaseVersion=${{ env.RELEASE_VERSION }} | ||
grep -m 1 "<version>" pom.xml | ||
git ls -5 | ||
|
||
- name: Set up GPG key | ||
env: | ||
GPG_TTY: $(tty) | ||
run: | | ||
echo "${{ secrets.GPG_SECRET }}" > ${{ env.GPG_KEY_FILE }} | ||
chmod 600 ${{ env.GPG_KEY_FILE }} | ||
gpg --import --batch ${{ env.GPG_KEY_FILE }} | ||
gpg --batch --yes --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSPHRASE }}" --sign ${{ env.GPG_KEY_FILE }} | ||
|
||
- name: Publish release | ||
env: | ||
NEXUS_USERNAME: "${{ secrets.NEXUS_USERNAME }}" | ||
NEXUS_PASSWORD: "${{ secrets.NEXUS_PASSWORD }}" | ||
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}" | ||
run: | | ||
git checkout ${{ env.RELEASE_VERSION }} | ||
git ls -5 | ||
cat ~/.m2/settings.xml | ||
mvn -V -B -U -e -T2C deploy -Poss-release \ | ||
-DautoReleaseAfterClose=true \ | ||
-DkeepStagingRepositoryOnCloseRuleFailure=true \ | ||
-DkeepStagingRepositoryOnFailure=true \ | ||
-DstagingProgressTimeoutMinutes=10 | ||
|
||
- name: Push changes and tags | ||
run: | | ||
git checkout master | ||
git ls -5 | ||
git push origin master --tags |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@imjalpreet FYI, to publish the maven artifacts we need upgrade airbase to 107+.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@unidevel I have included this change in #67 which upgrades this repo to Java 17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until now, I was upgrading to 105, which was required to bring in Java 17 changes, but I can change it to 107 if there are more changes that are required for publishing the artifacts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@unidevel, I kept my changes to upgrade to airbase 105 as it was required for Java 17. We can upgrade to 107 in this PR. Can you please help rebase on master to resolve conflicts?