-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (81 loc) · 2.87 KB
/
check-release.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Check Release
on:
pull_request:
branches:
- release/cli
types:
- labeled
- unlabeled
- synchronize
- opened
jobs:
check-label:
runs-on: ubuntu-latest
outputs:
level: ${{ steps.release-label.outputs.level }}
steps:
- uses: actions-ecosystem/action-release-label@v1
id: release-label
with:
label_prefix: "bump:"
find-comment:
runs-on: ubuntu-latest
outputs:
comment-id: ${{ steps.fc.outputs.comment-id }}
steps:
- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "🤖 **Check Release**"
notify-new-version:
runs-on: ubuntu-latest
needs: [check-label, find-comment]
if: ${{ needs.check-label.outputs.level != null }}
steps:
- uses: actions/checkout@v4
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- uses: actions-ecosystem/action-bump-semver@v1
id: bump-semver
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: ${{needs.check-label.outputs.level }}
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ needs.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
🤖 **Check Release**
If you merge this pull request, the version of the CLI tool will be released.
- Current Version: ${{ steps.get-latest-tag.outputs.tag }}
- New Version: ${{ steps.bump-semver.outputs.new_version }}
edit-mode: replace
- name: Update title of pull request
run: |
gh pr edit ${{ github.event.pull_request.number }} --title "Release new version: ${{ steps.bump-semver.outputs.new_version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
notify-please-add-label:
runs-on: ubuntu-latest
needs: [check-label, find-comment]
if: ${{ needs.check-label.outputs.level == null }}
steps:
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ needs.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
🤖 **Check Release**
You forgot to add a label to bump the version.
Please add a label `bump:patch`, `bump:minor`, or `bump:major` to this pull request.
edit-mode: replace
- name: Update title of pull request
run: |
gh pr edit ${{ github.event.pull_request.number }} --title "Release new version"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}