Skip to content

Commit

Permalink
Refactor presto release actions
Browse files Browse the repository at this point in the history
  • Loading branch information
unidevel committed Mar 10, 2025
1 parent d05ee8f commit 469d7b1
Show file tree
Hide file tree
Showing 6 changed files with 432 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: Presto Stable Release Workflow
name: Presto Stable - Cut Release Branch

on:
workflow_dispatch:

jobs:
presto-release:
name: Presto Stable Release Workflow
cut-stable-release:
runs-on: ubuntu-latest
environment: release

Expand Down Expand Up @@ -60,11 +59,15 @@ jobs:
-DautoVersionSubmodules \
-DdevelopmentVersion=${{ env.PRESTO_RELEASE_VERSION }} \
-DreleaseVersion=${{ env.PRESTO_RELEASE_VERSION }}
grep -m 1 "<version>" pom.xml
git log --pretty="format:%ce: %s" -5
git push --follow-tags origin master
- name: Push release branch
env:
PRESTO_RELEASE_VERSION: ${{ steps.get-version.outputs.PRESTO_RELEASE_VERSION }}
run: |
git checkout -b release-${{ env.PRESTO_RELEASE_VERSION }}
git checkout ${{ env.PRESTO_RELEASE_VERSION }}
git switch -c release-${{ env.PRESTO_RELEASE_VERSION }}
git log --pretty="format:%ce: %s" -3
git push origin release-${{ env.PRESTO_RELEASE_VERSION }}
42 changes: 42 additions & 0 deletions .github/workflows/presto-release-notes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Presto Stable - Generate Release Notes

on:
workflow_dispatch:

env:
UPSTREAM: prestodb/presto

jobs:
release-notes:
runs-on: ubuntu-latest

steps:
- name: Check for master branch
if: ${{ github.ref != 'refs/heads/master' }}
run: echo "Invalid branch. This action can only be run on the master branch." && exit 1

- name: Check for personal repository
if: ${{ github.repository == env.UPSTREAM }}
run: echo "This action can only be run on personal repository, please clone ${{ env.UPSTREAM }}, and run this action in your own repo" && exit 1

- name: Checkout presto source
uses: actions/checkout@v4
with:
ref: master
show-progress: false

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'

- name: Add git upstream
run: |
git remote add upstream https://github.com/${{ env.UPSTREAM }}.git
git fetch upstream --tags
git remote -v
- name: Create release notes pull request
run: |
./src/release/release-notes.sh ${{ github.repository_owner }} ${{ secrets.GITHUB_TOKEN }}
108 changes: 108 additions & 0 deletions .github/workflows/presto-release-publish-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Presto Stable - Publish Docker Images

on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., 0.291)'
required: true
publish_as_latest:
description: 'Also publish as latest version'
type: boolean
default: true
required: false

env:
VERSION: ${{ github.event.inputs.version }}
DOCKER_REPO: ${{ github.repository }}

jobs:
maven-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.VERSION }}

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'

- name: Maven build
run: mvn clean install -DskipTests

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: presto-artifacts-${{ env.VERSION }}
retention-days: 1
path: |
presto-server/target/presto-server-*.tar.gz
presto-cli/target/presto-cli-*-executable.jar
docker-publish:
needs: [maven-build]
runs-on: ubuntu-latest
environment: release
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.VERSION }}

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: presto-artifacts-${{ env.VERSION }}
path: ./

- name: Login to dockerhub
uses: docker/login-action@v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to gitHub container registry
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PRESTODB_CI_TOKEN }}

- name: Set up qemu
uses: docker/setup-qemu-action@v3

- name: Set up docker buildx
uses: docker/setup-buildx-action@v3.9.0

- name: Create and use builder
run: |
docker buildx create --name container --use
docker buildx inspect --bootstrap
- name: Move artifacts to docker directory
run: |
mv ./presto-server/target/presto-server-*.tar.gz docker/
mv ./presto-cli/target/presto-cli-*-executable.jar docker/
- name: Build docker image and publish
uses: docker/build-push-action@v6
with:
context: docker
platforms: linux/amd64,linux/arm64,linux/ppc64le
file: docker/Dockerfile
push: true
build-args: |
PRESTO_VERSION=${{ env.VERSION }}
JMX_PROMETHEUS_JAVAAGENT_VERSION=0.20.0
tags: |
${{ env.DOCKER_REPO }}:${{ env.VERSION }}
${{ github.event.inputs.publish_as_latest == 'true' && format('{0}:latest', env.DOCKER_REPO) || '' }}
ghcr.io/${{ github.repository }}:${{ env.VERSION }}
${{ github.event.inputs.publish_as_latest == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }}
111 changes: 111 additions & 0 deletions .github/workflows/presto-release-publish-maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Presto Stable - Publish Maven Artifacts

on:
workflow_dispatch:
inputs:
RELEASE_BRANCH:
description: 'Release branch (e.g., release-0.290)'
required: true
RELEASE_VERSION:
description: 'Release version (e.g., 0.290)'
required: true

jobs:
publish-stable-release:
runs-on: ubuntu-latest
environment: release
timeout-minutes: 300 # 5 hours

env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}

steps:
- name: Setup JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential git gpg python3 python3-venv
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.RELEASE_BRANCH }}
token: ${{ secrets.PRESTODB_CI_TOKEN }}
fetch-depth: 0
fetch-tags: true

- name: Configure Git
run: |
git config --global user.email "ci@lists.prestodb.io"
git config --global user.name "prestodb-ci"
git checkout ${{ github.event.inputs.RELEASE_VERSION }}
git log --pretty="format:%ce: %s" -5
- name: Import GPG key
run: |
echo "${{ secrets.GPG_SECRET }}" > ${{ github.workspace }}/secret-key.gpg
chmod 600 ${{ github.workspace }}/secret-key.gpg
gpg --import --batch ${{ github.workspace }}/secret-key.gpg
rm -f ${{ github.workspace }}/secret-key.gpg
gpg --list-secret-keys
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
env:
GPG_TTY: $(tty)

- name: Create Maven Settings
run: |
cat > ${{ github.workspace }}/settings.xml << 'EOL'
<settings>
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<username>${env.NEXUS_USERNAME}</username>
<password>${env.NEXUS_PASSWORD}</password>
</server>
<server>
<id>sonatype.snapshots</id>
<username>${env.NEXUS_USERNAME}</username>
<password>${env.NEXUS_PASSWORD}</password>
</server>
<server>
<id>ossrh</id>
<username>${env.NEXUS_USERNAME}</username>
<password>${env.NEXUS_PASSWORD}</password>
</server>
</servers>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
EOL
- name: Release Maven Artifacts
run: |
unset MAVEN_CONFIG
./mvnw -s ${{ github.workspace }}/settings.xml -V -B -U -e -T1C deploy \
-Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" \
-Dmaven.wagon.http.retryHandler.count=8 \
-DskipTests \
-DstagingProfileId=28a0d8c4350ed \
-DkeepStagingRepositoryOnFailure=true \
-DkeepStagingRepositoryOnCloseRuleFailure=true \
-DautoReleaseAfterClose=true \
-DstagingProgressTimeoutMinutes=60 \
-Poss-release \
-Pdeploy-to-ossrh \
-pl '!presto-test-coverage'
env:
GPG_TTY: $(tty)
Loading

0 comments on commit 469d7b1

Please sign in to comment.