-
-
Notifications
You must be signed in to change notification settings - Fork 15
71 lines (58 loc) · 2.34 KB
/
Copy pathrelease-pr.yml
File metadata and controls
71 lines (58 loc) · 2.34 KB
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
66
67
68
69
70
71
concurrency:
cancel-in-progress: true
group: Prepare Release ${{ github.ref_name }}
jobs:
release_pr:
if: "!startsWith(github.event.head_commit.message, 'chore: release v')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: ./.github/actions/prepare
- run: pnpm build
- id: should_release
run: echo "should_release=$(pnpm run should-semantic-release &> /dev/null && pnpm run lint:package &> /dev/null && echo '1' || echo '0')" >> "$GITHUB_OUTPUT"
- env:
GITHUB_TOKEN: ${{ github.token }}
if: steps.should_release.outputs.should_release != '0'
run: pnpm dlx release-it --no-git.push --no-npm.publish --no-github.release --no-gitlab.release
- if: steps.should_release.outputs.should_release != '0'
name: Generate Docs
run: pnpm run docs
- if: steps.should_release.outputs.should_release != '0'
name: Update Coverage Badge
run: cp ./docs/generated/coverage.svg ./docs/coverage.svg
- id: package-version
if: steps.should_release.outputs.should_release != '0'
name: Get Release Version
uses: martinbeentjes/npm-get-version-action@v1.3.1
- env:
RELEASE_VERSION: ${{ steps.package-version.outputs.current-version }}
id: create_pr
if: steps.should_release.outputs.should_release != '0' && steps.package-version.outputs.current-version != ''
name: Create Pull Request
uses: peter-evans/create-pull-request@v8.1.1
with:
assignees: ${{ github.actor }}
base: ${{ github.ref_name }}
body: Merge this PR to release v${{ env.RELEASE_VERSION }}
branch: release/${{ github.ref_name }}
commit-message: "chore: release v${{ env.RELEASE_VERSION }}"
delete-branch: true
sign-commits: true
title: "chore: release v${{ env.RELEASE_VERSION }}"
token: ${{ github.token }}
- env:
GH_TOKEN: ${{ github.token }}
if: steps.create_pr.outputs.pull-request-operation == 'created'
name: Enable Pull Request Automerge
run: gh pr merge --squash --auto "${{ steps.create_pr.outputs.pull-request-number}}"
name: Create Release PR
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write