-
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.77 KB
/
create-release-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
# Copyright (c) 2020-2023 Koji Hasegawa.
# This software is released under the MIT License.
name: Create release pull request
# Must manually add the label `skip-changelog` to the repository before running this workflow.
on:
workflow_dispatch:
permissions: {}
defaults:
run:
shell: bash
jobs:
create-release-pr:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
pull-requests: write
steps:
- name: Get draft release version
uses: cardinalby/git-get-release-action@v1
with:
latest: true
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: get-draft-release
# Fail this step if not found draft release
- name: Generate next version number (remove prefix)
run: |
tag_with_prefix=${{ steps.get-draft-release.outputs.tag_name }}
without_prefix=${tag_with_prefix:1}
echo "version=$without_prefix" >> "$GITHUB_OUTPUT"
id: next-version
- uses: actions/checkout@v4
with:
ref: master
- name: Bump version and create pull-request
run: |
git config user.name github-actions
git config user.email [email protected]
git checkout -b release/${{ steps.next-version.outputs.version }}
npm version --no-git-tag-version ${{ steps.next-version.outputs.version }}
git add .
git commit -m"Bump version to v${{ steps.next-version.outputs.version }}"
git push origin HEAD
gh pr create --title "Release v${{ steps.next-version.outputs.version }}" --body-file ".github/release-pr-template.md" --reviewer ${{ github.actor }} --label "skip-changelog"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}