Android-Password-Store/.github/workflows/draft_new_release.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

95 lines
3.5 KiB
YAML
Raw Normal View History

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 }}"
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@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
with:
ref: ${{ env.CHECKOUT_REF }}
2020-06-18 06:31:18 +00:00
- name: Set up JDK
uses: actions/setup-java@3f07048e3d294f56e9b90ac5ea2c6f74e9ad0f98 # v3.10.0
2022-02-17 04:43:04 +00:00
with:
2022-05-25 12:29:04 +00:00
distribution: temurin
java-version: 18
2020-06-18 06:31:18 +00:00
- name: Update changelog
uses: thomaseizinger/keep-a-changelog-new-release@5bc232893483441c5d6cd6c9dcb1e48abf9a2bae # 1.3.0
2020-06-18 06:31:18 +00:00
with:
version: ${{ github.event.milestone.title }}
2020-06-18 06:31:18 +00:00
- name: Setup Gradle caching
uses: gradle/gradle-build-action@6095a76664413da4c8c134ee32e8a8ae900f0f1f # v2.4.0
with:
gradle-home-cache-cleanup: true
- 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: |
# 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
# 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@38e0b6e68b4c852a5500a94740f0e535e0d7ba54 # v4.2.4
2020-06-18 06:31:18 +00:00
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 }}