Presto Stable Release - Prepare #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Presto Stable - Prepare Release | |
on: | |
workflow_dispatch: | |
inputs: | |
skip_release_cut: | |
description: 'Skip cutting release branch' | |
type: boolean | |
default: false | |
required: false | |
jobs: | |
cut-release: | |
if: ${{ !inputs.skip_release_cut }} | |
runs-on: ubuntu-latest | |
environment: release | |
permissions: | |
contents: write | |
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: Checkout presto source | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PRESTODB_CI_TOKEN }} | |
ref: master | |
show-progress: false | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Configure git | |
run: | | |
git config --global --add safe.directory ${{github.workspace}} | |
git config --global user.email "ci@lists.prestodb.io" | |
git config --global user.name "prestodb-ci" | |
git config pull.rebase false | |
- name: Set maven version | |
run: | | |
unset MAVEN_CONFIG && ./mvnw versions:set -DremoveSnapshot -ntp | |
- name: Get Presto release version | |
id: get-version | |
run: | | |
PRESTO_RELEASE_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate \ | |
-Dexpression=project.version -q -ntp -DforceStdout | tail -n 1) | |
echo "PRESTO_RELEASE_VERSION=$PRESTO_RELEASE_VERSION" >> $GITHUB_ENV | |
echo "PRESTO_RELEASE_VERSION=$PRESTO_RELEASE_VERSION" | |
- name: Update version in master | |
run: | | |
git reset --hard | |
unset MAVEN_CONFIG && ./mvnw release:prepare --batch-mode \ | |
-DskipTests \ | |
-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 | |
run: | | |
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 }} | |
echo "In case cut release failed, please fix manually by running the following commands:" | |
echo "git clone ${{ github.server_url }}/${{ github.repository }}.git" | |
echo "git checkout ${{ env.PRESTO_RELEASE_VERSION }}" | |
echo "git switch -c release-${{ env.PRESTO_RELEASE_VERSION }}" | |
echo "git push origin release-${{ env.PRESTO_RELEASE_VERSION }}" | |
release-notes: | |
needs: [cut-release] | |
if: ${{ always() && (needs.cut-release.result == 'success' || inputs.skip_release_cut) }} | |
runs-on: ubuntu-latest | |
environment: release | |
permissions: | |
contents: write | |
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: 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: Configure git | |
run: | | |
git config --global --add safe.directory ${{github.workspace}} | |
git config --global user.email "ci@lists.prestodb.io" | |
git config --global user.name "prestodb-ci" | |
git config pull.rebase false | |
- name: Add git upstream | |
run: | | |
git remote add upstream ${{ github.server_url }}/${{ github.repository }}.git | |
git fetch upstream --tags | |
git remote -v | |
- name: Create release notes pull request | |
run: | | |
./src/release/release-notes.sh ${{ github.repository_owner }} ${{ secrets.PRESTODB_CI_TOKEN }} |