Skip to content

Commit e24a101

Browse files
authored
Add github action to prepare stable release (#24697)
* Combine github stable release action with add release-notes action * Update action name and messages for failure * Add publish presto release action * Add publishing docs to presto release publish action * Refactor the release actions by review comments * Fix incorrect usage of gpg passphrase * Refactor action based on review comments * Fix the cancel state of publish action * Publish dependency image to dockerhub * Fix action dependency checking * Update descriptions in the release actions * Remove presto-release-publish.yml first
1 parent 4eb4ce2 commit e24a101

File tree

2 files changed

+136
-70
lines changed

2 files changed

+136
-70
lines changed
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Presto Stable Release - Prepare
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
prepare_release:
7+
description: 'Prepare release branch and tag'
8+
type: boolean
9+
default: true
10+
required: false
11+
prepare_release_notes:
12+
description: 'Prepare release notes pull request'
13+
type: boolean
14+
default: true
15+
required: false
16+
17+
env:
18+
JAVA_VERSION: '11'
19+
JAVA_DISTRIBUTION: 'temurin'
20+
21+
jobs:
22+
prepare-release-branch:
23+
if: ${{ inputs.prepare_release }}
24+
runs-on: ubuntu-latest
25+
environment: release
26+
permissions:
27+
contents: write
28+
29+
steps:
30+
- name: Check for master branch
31+
if: ${{ github.ref != 'refs/heads/master' }}
32+
run: echo "Invalid branch. This action can only be run on the master branch." && exit 1
33+
34+
- name: Checkout presto source
35+
uses: actions/checkout@v4
36+
with:
37+
token: ${{ secrets.PRESTODB_CI_TOKEN }}
38+
ref: master
39+
show-progress: false
40+
fetch-depth: 5
41+
42+
- name: Set up JDK
43+
uses: actions/setup-java@v4
44+
with:
45+
java-version: ${{ env.JAVA_VERSION }}
46+
distribution: ${{ env.JAVA_DISTRIBUTION }}
47+
48+
- name: Configure git
49+
run: |
50+
git config --global --add safe.directory ${{github.workspace}}
51+
git config --global user.email "[email protected]"
52+
git config --global user.name "prestodb-ci"
53+
git config --global alias.ls 'log --pretty=format:"%cd %h %ce: %s" --date=short --no-merges'
54+
git config pull.rebase false
55+
56+
- name: Set presto release version
57+
run: |
58+
unset MAVEN_CONFIG && ./mvnw versions:set -DremoveSnapshot -ntp
59+
60+
- name: Get presto release version
61+
id: get-version
62+
run: |
63+
PRESTO_RELEASE_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate \
64+
-Dexpression=project.version -q -ntp -DforceStdout | tail -n 1)
65+
echo "PRESTO_RELEASE_VERSION=$PRESTO_RELEASE_VERSION" >> $GITHUB_ENV
66+
echo "PRESTO_RELEASE_VERSION=$PRESTO_RELEASE_VERSION"
67+
68+
- name: Prepare release tag and commits
69+
run: |
70+
git reset --hard
71+
unset MAVEN_CONFIG && ./mvnw release:prepare --batch-mode \
72+
-DskipTests \
73+
-DautoVersionSubmodules \
74+
-DdevelopmentVersion=${{ env.PRESTO_RELEASE_VERSION }} \
75+
-DreleaseVersion=${{ env.PRESTO_RELEASE_VERSION }}
76+
grep -m 2 "<version>" pom.xml
77+
echo "commits on master branch"
78+
git ls -5
79+
80+
- name: Push release tag, branch and commits
81+
run: |
82+
echo "In case this job failed, please delete the tag ${{ env.PRESTO_RELEASE_VERSION }} and the branch release-${{ env.PRESTO_RELEASE_VERSION }}, and re-run the job"
83+
git checkout ${{ env.PRESTO_RELEASE_VERSION }}
84+
git switch -c release-${{ env.PRESTO_RELEASE_VERSION }}
85+
echo "Pushing release branch release-${{ env.PRESTO_RELEASE_VERSION }} and tag ${{ env.PRESTO_RELEASE_VERSION }}"
86+
87+
echo "commits on release-${{ env.PRESTO_RELEASE_VERSION }} branch"
88+
git ls -4
89+
git push origin release-${{ env.PRESTO_RELEASE_VERSION }} --tags
90+
echo -e "\nPushed release tag to: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ env.PRESTO_RELEASE_VERSION }}"
91+
echo "Pushed release branch to: ${{ github.server_url }}/${{ github.repository }}/tree/release-${{ env.PRESTO_RELEASE_VERSION }}"
92+
93+
echo "Pushing master branch"
94+
git checkout master
95+
echo "commits on master branch"
96+
git ls -5
97+
git push origin master
98+
99+
prepare-release-notes:
100+
needs: prepare-release-branch
101+
if: ${{ inputs.prepare_release_notes && always() && (needs.prepare-release-branch.result == 'success' || !inputs.prepare_release) }}
102+
runs-on: ubuntu-latest
103+
environment: release
104+
permissions:
105+
contents: write
106+
107+
steps:
108+
- name: Checkout presto source
109+
uses: actions/checkout@v4
110+
with:
111+
ref: master
112+
show-progress: false
113+
114+
- name: Set up JDK
115+
uses: actions/setup-java@v4
116+
with:
117+
java-version: ${{ env.JAVA_VERSION }}
118+
distribution: ${{ env.JAVA_DISTRIBUTION }}
119+
120+
- name: Configure git
121+
run: |
122+
git config --global --add safe.directory ${{github.workspace}}
123+
git config --global user.email "[email protected]"
124+
git config --global user.name "prestodb-ci"
125+
git config pull.rebase false
126+
127+
- name: Add git upstream
128+
run: |
129+
git remote add upstream ${{ github.server_url }}/${{ github.repository }}.git
130+
git fetch upstream --tags
131+
git remote -v
132+
133+
- name: Create release notes pull request
134+
run: |
135+
echo "In case this job failed, please delete the release notes branch(e.g. release-notes-0.292) in repository ${{ github.repository }}, and re-run the job"
136+
./src/release/release-notes.sh ${{ github.repository_owner }} ${{ secrets.PRESTODB_CI_TOKEN }}

.github/workflows/presto-stable-release.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)