Skip to content

Release: Create release branch #18

Release: Create release branch

Release: Create release branch #18

name: "Release: Create release branch"
on:
workflow_dispatch:
branches:
- "develop"
- "feature/prepareReleaseForDM-CMEM-4151" # TODO: only for testing, remove it later
inputs:
releasetype:
description: 'Type of release'
required: true
type: choice
options:
- patch
- minor
- major
jobs:
create-release-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Update package.json with new release candidate version
id: create-version
run: |
yarn version --no-git-tag-version --preid "rc" --pre${{ github.event.inputs.releasetype }}
echo "version=$(node -p -e "require('./package.json').version.split('-').shift()")" >> $GITHUB_OUTPUT
- name: Create release branch
id: create-branch
run: |
git checkout -b release/v${{ steps.create-version.outputs.version }}
echo "label=release/v${{ steps.create-version.outputs.version }}" >> $GITHUB_OUTPUT
- name: Initialize mandatory git config
# @see https://github.community/t/how-do-i-get-gh-username-based-on-actions-events/17882
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Commit version number update
id: make-commit
run: |
git commit package.json --message "Prepare release v${{ steps.create-version.outputs.version }}"
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Push release branch
run: git push origin ${{ steps.create-branch.outputs.label }}
- name: Create pull request into main
uses: thomaseizinger/create-pull-request@master
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
head: ${{ steps.create-branch.outputs.label }}
base: main
title: Release v${{ steps.create-version.outputs.version }} into main branch
draft: true
reviewers: ${{ github.actor }}
body: |
Created by Github workflow to create release branches.
Merge this PR will trigger a tag creation and package release.