-
Notifications
You must be signed in to change notification settings - Fork 541
57 lines (51 loc) · 1.6 KB
/
release-create-pr.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
name: Create release PR
permissions:
contents: read
on:
workflow_dispatch:
inputs:
version:
description: 'The version number to release (has priority over release_type)'
type: string
release_type:
description: Type of release
type: choice
default: patch
options:
- patch
- minor
- major
jobs:
create-pr:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
outputs:
version: ${{ steps.bump.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Git Config
run: |
git config --global user.email "[email protected]"
git config --global user.name "github-actions"
- name: Change version number and push
id: bump
run: |
npm version ${{ inputs.version || inputs.release_type }} --git-tag-version=false
VERSION=`jq -r ".version" package.json`
RELEASE_BRANCH="release/v$VERSION"
git add -u
git commit -m "Bumped v$VERSION"
git push origin "HEAD:$RELEASE_BRANCH"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create PR
uses: actions/github-script@v7
with:
script: |
const defaultBranch = "${{ github.event.repository.default_branch }}"
const versionTag = "v${{ steps.bump.outputs.version }}"
await require('./scripts/release').generatePr({ github, context, defaultBranch, versionTag })