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 d5ad83adecc12..24412c54d609a 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: 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 @@ -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-release-notes.yml b/.github/workflows/presto-release-notes.yml new file mode 100644 index 0000000000000..014756944ada0 --- /dev/null +++ b/.github/workflows/presto-release-notes.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/presto-release-publish-image.yml b/.github/workflows/presto-release-publish-image.yml new file mode 100644 index 0000000000000..8c919a4b0a5ad --- /dev/null +++ b/.github/workflows/presto-release-publish-image.yml @@ -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) || '' }} diff --git a/.github/workflows/presto-release-publish-maven.yml b/.github/workflows/presto-release-publish-maven.yml new file mode 100644 index 0000000000000..083c8b556a128 --- /dev/null +++ b/.github/workflows/presto-release-publish-maven.yml @@ -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' + + + + 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) diff --git a/.github/workflows/presto-release-publish-native-image.yml b/.github/workflows/presto-release-publish-native-image.yml new file mode 100644 index 0000000000000..82ab593514dd6 --- /dev/null +++ b/.github/workflows/presto-release-publish-native-image.yml @@ -0,0 +1,114 @@ +name: Presto Stable - Publish Native Docker Image + +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 + dependency_image: + description: 'Dependency image(e.g., prestodb/presto-native-dependency:0.290-20241014120930-e1fc090)' + required: false + default: '' + +env: + VERSION: ${{ github.event.inputs.version }} + ORG_NAME: ${{ github.repository_owner }} + IMAGE_NAME: presto-native + +jobs: + build-images: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + environment: release + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ env.VERSION }} + submodules: true + + - name: Initialize Prestissimo submodules + run: | + cd presto-native-execution && make submodules + echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + + - 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.GITHUB_TOKEN }} + + - name: Set dependency image tag + run: | + if [[ -n "${{ github.event.inputs.dependency_image }}" ]]; then + echo "DEPENDENCY_IMAGE=${{ github.event.inputs.dependency_image }}" >> $GITHUB_ENV + else + echo "DEPENDENCY_IMAGE=ghcr.io/${{ github.repository_owner }}/presto-native-dependency:${{ env.VERSION }}-${{ env.COMMIT_SHA }}" >> $GITHUB_ENV + fi + + - name: Build Dependency Image + working-directory: presto-native-execution + run: | + if docker pull ${{ env.DEPENDENCY_IMAGE }}; then + echo "Using dependency image ${{ env.DEPENDENCY_IMAGE }}" + docker tag ${{ env.DEPENDENCY_IMAGE }} presto/prestissimo-dependency:centos9 + else + echo "Building new depedency image" + docker compose build centos-native-dependency + docker tag presto/prestissimo-dependency:centos9 ghcr.io/${{ github.repository_owner }}/presto-native-dependency:${{ env.VERSION }}-${{ env.COMMIT_SHA }} + docker push ghcr.io/${{ github.repository_owner }}/presto-native-dependency:${{ env.VERSION }}-${{ env.COMMIT_SHA }} + fi + docker images + + - name: Build Runtime Image + working-directory: presto-native-execution + run: | + if docker pull ghcr.io/${{ github.repository_owner }}/presto-native:${{ env.VERSION }}-${{ env.COMMIT_SHA }}; then + docker tag ghcr.io/${{ github.repository_owner }}/presto-native:${{ env.VERSION }}-${{ env.COMMIT_SHA }} docker.io/presto/prestissimo-runtime:centos9 + else + docker compose build centos-native-runtime + docker tag presto/prestissimo-runtime:centos9 ghcr.io/${{ github.repository_owner }}/presto-native:${{ env.VERSION }}-${{ env.COMMIT_SHA }} + docker push ghcr.io/${{ github.repository_owner }}/presto-native:${{ env.VERSION }}-${{ env.COMMIT_SHA }} + fi + + - name: Add release tag + working-directory: presto-native-execution + run: | + docker tag presto/prestissimo-runtime:centos9 ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} + if [[ "${{ github.event.inputs.publish_as_latest }}" == "true" ]]; then + docker tag presto/prestissimo-runtime:centos9 ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:latest + fi + + - name: Push to DockerHub + run: | + docker push ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} + if [[ "${{ github.event.inputs.publish_as_latest }}" == "true" ]]; then + docker tag ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:latest + docker push ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:latest + fi + + - name: Tag and push to GitHub Packages + run: | + docker tag ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} + docker push ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} + if [[ "${{ github.event.inputs.publish_as_latest }}" == "true" ]]; then + docker tag ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest + docker push ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest + fi \ No newline at end of file diff --git a/.github/workflows/presto-release-tag-finalize.yml b/.github/workflows/presto-release-tag-finalize.yml new file mode 100644 index 0000000000000..ce3a9615fd9ac --- /dev/null +++ b/.github/workflows/presto-release-tag-finalize.yml @@ -0,0 +1,50 @@ +name: Presto Stable - Tag Finalize + +on: + workflow_dispatch: + inputs: + release-tag: + description: 'Release tag (e.g., 0.291)' + required: true + release-notes-commit: + description: 'Commit hash containing release notes' + required: true + +env: + RELEASE_BRANCH: release-${{ github.event.inputs.release-tag }} + RELEASE_TAG: ${{ github.event.inputs.release-tag }} + RELEASE_NOTES_COMMIT: ${{ github.event.inputs.release-notes-commit }} + +jobs: + finalize-release: + runs-on: ubuntu-latest + environment: release + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ env.RELEASE_BRANCH }} + token: ${{ secrets.PRESTODB_CI_TOKEN }} + fetch-depth: 0 + fetch-tags: true + show-progress: false + + - name: Configure Git + run: | + git config --global user.email "ci@lists.prestodb.io" + git config --global user.name "prestodb-ci" + git config pull.rebase false + + - name: Cherry-pick release notes + run: | + git cherry-pick ${{ env.RELEASE_NOTES_COMMIT }} + + - name: Delete existing release tag + run: | + git push origin :${{ env.RELEASE_TAG }} || true + git tag -d ${{ env.RELEASE_TAG }} || true + + - name: Create new release tag + run: | + git tag -a ${{ env.RELEASE_TAG }} -m "release ${{ env.RELEASE_TAG }}" + git push origin ${{ env.RELEASE_BRANCH }} --tags \ No newline at end of file