-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (57 loc) · 2.28 KB
/
release-branch.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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.