forked from prestodb/presto
-
Notifications
You must be signed in to change notification settings - Fork 1
121 lines (104 loc) · 4.11 KB
/
presto-release-prepare.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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 }}