2022-02-17 04:43:04 +00:00
|
|
|
name: Draft new release
|
2020-06-18 06:31:18 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
milestone:
|
|
|
|
types: [closed]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
draft-new-release:
|
2022-02-17 04:43:04 +00:00
|
|
|
name: Draft a new release
|
2020-06-18 06:31:18 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Extract version from milestone
|
2022-02-17 04:43:04 +00:00
|
|
|
shell: bash
|
2020-06-18 06:31:18 +00:00
|
|
|
run: |
|
|
|
|
VERSION="${{ github.event.milestone.title }}"
|
2021-01-20 14:57:04 +00:00
|
|
|
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
|
|
|
|
|
2023-04-13 17:22:28 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
2021-01-20 14:57:04 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ env.CHECKOUT_REF }}
|
2020-06-18 06:31:18 +00:00
|
|
|
|
2023-05-27 22:11:27 +00:00
|
|
|
- name: Accept all SDK licenses
|
|
|
|
shell: bash
|
|
|
|
run: printf 'y\ny\ny\ny\ny\ny\n' | $ANDROID_HOME/tools/bin/sdkmanager --licenses
|
|
|
|
|
|
|
|
- name: Get build-tools directory
|
|
|
|
id: build-tools-path
|
|
|
|
shell: bash
|
|
|
|
run: echo "dir=${ANDROID_HOME}/build-tools/34.0.0-rc3" >> "${GITHUB_OUTPUT}"
|
|
|
|
|
|
|
|
- name: Cache build-tools
|
2023-05-28 04:33:26 +00:00
|
|
|
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
|
2023-05-27 22:11:27 +00:00
|
|
|
with:
|
|
|
|
path: ${{ steps.build-tools-path.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-34.0.0-rc3
|
|
|
|
|
2021-12-06 18:34:30 +00:00
|
|
|
- name: Set up JDK
|
2023-03-27 19:27:47 +00:00
|
|
|
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
|
2022-02-17 04:43:04 +00:00
|
|
|
with:
|
2022-05-25 12:29:04 +00:00
|
|
|
distribution: temurin
|
2022-09-05 08:21:05 +00:00
|
|
|
java-version: 18
|
2021-12-06 18:34:30 +00:00
|
|
|
|
2020-06-18 06:31:18 +00:00
|
|
|
- name: Update changelog
|
2022-11-12 19:54:33 +00:00
|
|
|
uses: thomaseizinger/keep-a-changelog-new-release@5bc232893483441c5d6cd6c9dcb1e48abf9a2bae # 1.3.0
|
2020-06-18 06:31:18 +00:00
|
|
|
with:
|
2021-01-20 14:57:04 +00:00
|
|
|
version: ${{ github.event.milestone.title }}
|
2020-06-18 06:31:18 +00:00
|
|
|
|
2022-08-30 16:38:46 +00:00
|
|
|
- name: Setup Gradle caching
|
2023-04-15 04:59:57 +00:00
|
|
|
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2
|
2022-08-30 16:38:46 +00:00
|
|
|
with:
|
|
|
|
gradle-home-cache-cleanup: true
|
|
|
|
|
2020-10-10 06:59:13 +00:00
|
|
|
- name: Initialize git config and commit changes
|
2022-02-17 04:43:04 +00:00
|
|
|
shell: bash
|
2020-06-18 06:31:18 +00:00
|
|
|
run: |
|
2021-01-20 14:57:04 +00:00
|
|
|
# Configure name and email for Actions user
|
2020-06-18 06:31:18 +00:00
|
|
|
git config user.name "GitHub Actions"
|
|
|
|
git config user.email noreply@github.com
|
|
|
|
|
2021-01-20 14:57:04 +00:00
|
|
|
# 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
|
2022-06-10 17:57:56 +00:00
|
|
|
./gradlew --no-daemon clearPreRelease
|
2021-01-20 14:57:04 +00:00
|
|
|
else
|
2022-06-10 17:57:56 +00:00
|
|
|
./gradlew --no-daemon bumpPatch
|
2021-01-20 14:57:04 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Commit changes to the versioning
|
|
|
|
git add **/version.properties
|
|
|
|
git commit -m "build: bump version"
|
|
|
|
|
2020-09-02 12:48:18 +00:00
|
|
|
- name: Create Pull Request
|
2023-05-02 04:21:58 +00:00
|
|
|
uses: peter-evans/create-pull-request@284f54f989303d2699d373481a0cfa13ad5a6666 # v5.0.1
|
2020-06-18 06:31:18 +00:00
|
|
|
with:
|
2020-10-23 09:33:45 +00:00
|
|
|
author: GitHub Actions <noreply@github.com>
|
2021-01-20 14:57:04 +00:00
|
|
|
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 }}
|
2020-10-23 09:33:45 +00:00
|
|
|
title: Release v${{ env.RELEASE_VERSION }}
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|