Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .github/workflows/release.yml
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
18 changes: 10 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.facebook.airlift</groupId>
<artifactId>airbase</artifactId>
<version>105</version>
<version>107</version>
Copy link
Contributor Author

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+.

Copy link
Member

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

Copy link
Member

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.

Copy link
Member

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?

</parent>

<groupId>com.facebook.presto.hadoop</groupId>
Expand Down Expand Up @@ -709,13 +709,15 @@
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${dep.nexus-staging-plugin.version}</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>${dep.central-publishing.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<deploymentName>presto-hadoop-apache</deploymentName>
<publishingServerId>ossrh</publishingServerId>
<autoPublish>true</autoPublish>
<waitUntil>validated</waitUntil>
</configuration>
</plugin>
</plugins>
Expand All @@ -727,8 +729,8 @@
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Expand Down