Prepare Release #6
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: | |
versionName: | |
description: "Name of version (ie 5.5.0)" | |
required: true | |
jobs: | |
prepare-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Check the input version | |
run: | | |
versionNumber=${{ github.event.inputs.versionName }} | |
if [[ $versionNumber =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then | |
echo '### :rocket: Preparing the release!' >> $GITHUB_STEP_SUMMARY | |
else | |
echo '### :boom: Please supply valid version according to the [Semantic Versioning](https://semver.org/) scheme.' >> $GITHUB_STEP_SUMMARY | |
exit 1 | |
fi | |
- name: Create release branch | |
run: git checkout -b release/v${{ github.event.inputs.versionName }} | |
- name: Initialize mandatory git config | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email noreply@github.com | |
- name: Change version number and name | |
run: yarn version --no-git-tag-version --no-commit-hook --new-version ${{ github.event.inputs.versionName }} | |
- name: Update Changelog | |
uses: thomaseizinger/keep-a-changelog-new-release@v1 | |
with: | |
version: ${{ github.event.inputs.versionName }} | |
- name: Commit changelog and manifest files | |
id: make-commit | |
run: | | |
git add package.json | |
git add CHANGELOG.md | |
git commit --message "Prepare release ${{ github.event.inputs.versionName }}" | |
echo "::set-output name=commit::$(git rev-parse HEAD)" | |
- name: Push new branch | |
run: git push origin release/v${{ github.event.inputs.versionName }} | |
- name: Create pull request into main | |
uses: thomaseizinger/create-pull-request@1.0.0 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
head: release/v${{ github.event.inputs.versionName }} | |
base: main | |
title: v${{ github.event.inputs.versionName }} into main | |
reviewers: ${{ github.event.issue.user.login }} | |
body: | | |
Hi! | |
This PR was created in response workflow running. | |
I've updated the version name and code commit: ${{ steps.make-commit.outputs.commit }}. |