blob: 025aaab406d16cf15884a9a38ea2b60e79f8cfd3 (
about) (
plain)
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
|
name: Draft new release
on:
milestone:
types: [closed]
jobs:
draft-new-release:
name: Draft a new release
runs-on: ubuntu-latest
steps:
- name: Extract version from milestone
shell: bash
run: |
VERSION="${{ github.event.milestone.title }}"
RELEASE_VERSION="${VERSION/v/}"
# Transforms 1.13.2 to 1.13 so that we can re-use the same
# branch for patch releases.
BRANCH_VERSION="${RELEASE_VERSION:$i:-2}"
if [[ "${RELEASE_VERSION: -1}" == "0" ]]; then
CHECKOUT_REF="develop"
else
CHECKOUT_REF="release-${BRANCH_VERSION}"
fi
# Export variables separately so the scripting above is more legible,
# and we can actually use them within this block. Changes to $GITHUB_ENV
# only affect the next step, not the current one.
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
echo "CHECKOUT_REF=${CHECKOUT_REF}" >> $GITHUB_ENV
echo "BRANCH_VERSION=${BRANCH_VERSION}" >> $GITHUB_ENV
echo "PR_BASE=release-${BRANCH_VERSION}" >> $GITHUB_ENV
echo "PR_HEAD=release-prep" >> $GITHUB_ENV
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ env.CHECKOUT_REF }}
- name: Set up JDK
uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b # v3.9.0
with:
distribution: temurin
java-version: 18
- name: Update changelog
uses: thomaseizinger/keep-a-changelog-new-release@5bc232893483441c5d6cd6c9dcb1e48abf9a2bae # 1.3.0
with:
version: ${{ github.event.milestone.title }}
- name: Setup Gradle caching
uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef # v2.3.3
with:
gradle-home-cache-cleanup: true
- name: Initialize git config and commit changes
shell: bash
run: |
# Configure name and email for Actions user
git config user.name "GitHub Actions"
git config user.email noreply@github.com
# It is necessary to create the $PR_BASE branch if it doesn't
# already exist because we want to start a PR against it.
if [[ "${CHECKOUT_REF}" == "develop" ]]; then
git branch -c develop "${PR_BASE}"
git push origin "${PR_BASE}"
fi
# Stage and commit changes to the changelog
git add CHANGELOG.md
git commit -m "CHANGELOG: bump for ${{ github.event.milestone.title }}"
# Increment the version as necessary. If we checked out develop it means
# that the version number is already correct, and we only need to drop the
# -SNAPSHOT suffix.
if [[ "${CHECKOUT_REF}" == "develop" ]]; then
./gradlew --no-daemon clearPreRelease
else
./gradlew --no-daemon bumpPatch
fi
# Commit changes to the versioning
git add **/version.properties
git commit -m "build: bump version"
- name: Create Pull Request
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4.2.3
with:
author: GitHub Actions <noreply@github.com>
body: This is an automated pull request to bump the changelog for the ${{ github.event.milestone.title }} release.
base: ${{ env.PR_BASE }}
branch: ${{ env.PR_HEAD }}
title: Release v${{ env.RELEASE_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
|