-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (58 loc) · 1.85 KB
/
version.yaml
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
61
62
63
64
65
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