Create new version #92
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: Create new version | |
on: | |
workflow_dispatch: | |
inputs: | |
release_type: | |
type: choice | |
description: Release type | |
required: true | |
default: beta | |
options: | |
- production | |
- beta | |
version_bump: | |
type: choice | |
description: Level | |
required: true | |
default: patch | |
options: | |
# Increases the prerelease version: 1.0.1-beta.0 -> 1.0.1-beta.1 | |
- prerelease | |
- patch | |
- minor | |
- major | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
bump_version: | |
name: Bump version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.inputs.release_type == 'beta' && 'develop' || 'main' }} | |
- name: Bump version in package.json | |
id: version | |
run: | | |
yarn config set version-git-tag false | |
if [[ ${{ github.event.inputs.release_type }} == 'beta' ]]; then | |
if [[ ${{ github.event.inputs.version_bump }} == 'prerelease' ]]; then | |
yarn version --prerelease | |
else | |
yarn version --preid beta --pre${{ github.event.inputs.version_bump }} | |
fi | |
else | |
yarn version --${{ github.event.inputs.version_bump }} | |
fi | |
echo "version=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
title: Bump version to ${{ steps.version.outputs.version }} | |
commit-message: Bump version to ${{ steps.version.outputs.version }} | |
branch: release/${{ steps.version.outputs.version }} | |
base: ${{ github.event.inputs.release_type == 'beta' && 'develop' || 'main' }} | |
delete-branch: true |