From 1b11ff62e5f08644f40c8f882fa4ee26b7a4070d Mon Sep 17 00:00:00 2001 From: unidevel Date: Tue, 11 Feb 2025 10:03:45 +0000 Subject: [PATCH 1/2] Add publish release action --- .github/workflows/presto-publish-release.yml | 111 +++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 .github/workflows/presto-publish-release.yml diff --git a/.github/workflows/presto-publish-release.yml b/.github/workflows/presto-publish-release.yml new file mode 100644 index 000000000000..67639ad1cfd3 --- /dev/null +++ b/.github/workflows/presto-publish-release.yml @@ -0,0 +1,111 @@ +name: Publish Presto Release + +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-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' + + + + sonatype-nexus-snapshots + ${env.NEXUS_USERNAME} + ${env.NEXUS_PASSWORD} + + + sonatype.snapshots + ${env.NEXUS_USERNAME} + ${env.NEXUS_PASSWORD} + + + ossrh + ${env.NEXUS_USERNAME} + ${env.NEXUS_PASSWORD} + + + + + nexus + + + + + + nexus + + + 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) From fa2abe761e7ff6c510b3158099841957f06f2a75 Mon Sep 17 00:00:00 2001 From: unidevel Date: Tue, 11 Feb 2025 14:57:11 +0000 Subject: [PATCH 2/2] Refactor release actions and fix wrong branch commit in cut release action --- ...esto-stable-release.yml => presto-release-cut.yml} | 11 +++++++---- ...publish-release.yml => presto-release-publish.yml} | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) rename .github/workflows/{presto-stable-release.yml => presto-release-cut.yml} (87%) rename .github/workflows/{presto-publish-release.yml => presto-release-publish.yml} (98%) diff --git a/.github/workflows/presto-stable-release.yml b/.github/workflows/presto-release-cut.yml similarity index 87% rename from .github/workflows/presto-stable-release.yml rename to .github/workflows/presto-release-cut.yml index d5ad83adecc1..2abaa0dff84f 100644 --- a/.github/workflows/presto-stable-release.yml +++ b/.github/workflows/presto-release-cut.yml @@ -1,11 +1,10 @@ -name: Presto Stable Release Workflow +name: Cut Presto Stable Release on: workflow_dispatch: jobs: - presto-release: - name: Presto Stable Release Workflow + cut-stable-release: runs-on: ubuntu-latest environment: release @@ -60,11 +59,15 @@ jobs: -DautoVersionSubmodules \ -DdevelopmentVersion=${{ env.PRESTO_RELEASE_VERSION }} \ -DreleaseVersion=${{ env.PRESTO_RELEASE_VERSION }} + grep -m 1 "" 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 }} diff --git a/.github/workflows/presto-publish-release.yml b/.github/workflows/presto-release-publish.yml similarity index 98% rename from .github/workflows/presto-publish-release.yml rename to .github/workflows/presto-release-publish.yml index 67639ad1cfd3..916434be082c 100644 --- a/.github/workflows/presto-publish-release.yml +++ b/.github/workflows/presto-release-publish.yml @@ -1,4 +1,4 @@ -name: Publish Presto Release +name: Publish Presto Stable Release on: workflow_dispatch: @@ -11,7 +11,7 @@ on: required: true jobs: - publish-release: + publish-stable-release: runs-on: ubuntu-latest environment: release timeout-minutes: 300 # 5 hours