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
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
1 change: 1 addition & 0 deletions drift-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</parent>

<artifactId>drift-api</artifactId>
<name>drift-api</name>
<description>Drift annotations and exceptions for use in Thrift interfaces and types</description>
<packaging>jar</packaging>

Expand Down
1 change: 1 addition & 0 deletions drift-codec-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</parent>

<artifactId>drift-codec-utils</artifactId>
<name>drift-codec-utils</name>
<description>Default codecs for common data structures</description>
<packaging>jar</packaging>

Expand Down
1 change: 1 addition & 0 deletions drift-codec/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</parent>

<artifactId>drift-codec</artifactId>
<name>drift-codec</name>
<description>Annotation based encoder and decoder for Thrift</description>
<packaging>jar</packaging>

Expand Down
1 change: 1 addition & 0 deletions drift-idl-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</parent>

<artifactId>drift-idl-generator</artifactId>
<name>drift-idl-generator</name>
<description>Generate Thrift IDL from Drift annotated classes</description>
<packaging>jar</packaging>

Expand Down
1 change: 1 addition & 0 deletions drift-javadoc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</parent>

<artifactId>drift-javadoc</artifactId>
<name>drift-javadoc</name>
<description>Annotation processor to store the Javadoc of Drift classes</description>
<packaging>jar</packaging>

Expand Down
1 change: 1 addition & 0 deletions drift-javadoc/src/test/projects/basic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<groupId>com.facebook.drift.its</groupId>
<artifactId>basic</artifactId>
<name>basic</name>
<version>1.0</version>

<dependencies>
Expand Down
1 change: 1 addition & 0 deletions drift-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</parent>

<artifactId>drift-maven-plugin</artifactId>
<name>drift-maven-plugin</name>
<description>Maven plugin for Drift</description>
<packaging>maven-plugin</packaging>

Expand Down
1 change: 1 addition & 0 deletions drift-maven-plugin/src/test/projects/direct/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<groupId>com.facebook.drift.its</groupId>
<artifactId>basic</artifactId>
<name>direct</name>
<version>1.0</version>

<dependencies>
Expand Down
1 change: 1 addition & 0 deletions drift-maven-plugin/src/test/projects/recursive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<groupId>com.facebook.drift.its</groupId>
<artifactId>basic</artifactId>
<name>recursive</name>
<version>1.0</version>

<dependencies>
Expand Down
1 change: 1 addition & 0 deletions drift-protocol/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</parent>

<artifactId>drift-protocol</artifactId>
<name>drift-protocol</name>
<description>Core classes for Drift</description>
<packaging>jar</packaging>

Expand Down
31 changes: 10 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<dep.nexus-staging-plugin.version>1.6.8</dep.nexus-staging-plugin.version>

<dep.netty.version>4.1.115.Final</dep.netty.version>
<dep.central-publishing.version>0.8.0</dep.central-publishing.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -377,17 +378,6 @@
<preparationGoals>clean verify -DskipTests</preparationGoals>
</configuration>
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${dep.nexus-staging-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down Expand Up @@ -417,17 +407,16 @@
</gpgArguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>deploy-to-ossrh</id>
<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>
<version>${dep.central-publishing.version}</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>ossrh</publishingServerId>
<autoPublish>true</autoPublish>
<waitUntil>validated</waitUntil>
</configuration>
</plugin>
</plugins>
</build>
Expand Down