This repository has been archived by the owner on Aug 2, 2024. It is now read-only.
Prepare release #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Prepare release | |
on: | |
workflow_dispatch: | |
inputs: | |
release_version: | |
description: new release version | |
required: true | |
default: (for example, 0.10.5) | |
jobs: | |
release: | |
name: Prepare release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2.4.1 | |
- name: Check input | |
run: | | |
if [[ ! "${{ github.event.inputs.release_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo 'version "${{ github.event.inputs.release_version }}" not in ###.###.### format' | |
exit 1 | |
fi | |
if [[ $( git ls-remote --tags origin refs/tags/v${{ github.event.inputs.release_version }} ) ]]; then | |
echo 'Tag "v${{ github.event.inputs.release_version }}" already exists. Double-check the version to release!' | |
exit 1 | |
fi | |
- name: Create tag for release and prepare branch for next development version | |
run: | | |
git checkout -b release-v${{ github.event.inputs.release_version }} | |
git config user.email ${{ github.actor }}@users.noreply.github.com | |
git config user.name ${{ github.actor }} | |
./mvnw --batch-mode versions:set versions:commit -DnewVersion=${{ github.event.inputs.release_version }} | |
git commit -am "preparing release ${{ github.event.inputs.release_version }}" | |
git tag v${{ github.event.inputs.release_version }} | |
./mvnw --batch-mode org.apache.maven.plugins:maven-release-plugin:2.5.3:update-versions | |
git commit -am "next development version" | |
git push origin v${{ github.event.inputs.release_version }} | |
git push origin release-v${{ github.event.inputs.release_version }} | |
- name: Create pull request | |
uses: repo-sync/pull-request@v2.6.2 | |
id: create-pr | |
with: | |
# Use a personal token to file a PR to trigger other workflows (e.g., unit tests). | |
# Save your access token as GA_RELEASE_PR_PERSONAL_TOKEN. | |
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token | |
# https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets | |
github_token: ${{ secrets.GA_RELEASE_PR_PERSONAL_TOKEN }} | |
source_branch: release-v${{ github.event.inputs.release_version }} | |
pr_title: "release v${{ github.event.inputs.release_version }}" | |
pr_body: "To be merged after the release is complete." | |
pr_label: "PR: Merge After Release" |