-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (55 loc) · 1.96 KB
/
pre-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
name: Generate changelog before release.yml
on:
pull_request:
types:
- opened
env:
PJ_NAME: tempura
jobs:
changelog:
name: Generate and commit changelog for ${{ github.head_ref }}
runs-on: ubuntu-latest
if: startsWith(github.head_ref, 'release/')
outputs:
changelog: ${{ steps.changelog.outputs.changes }}
steps:
- name: Setup | Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Parse version
run: |
ref=${{ github.head_ref }}
version=${ref#release/}
echo $version
echo "Version=$version" >> $GITHUB_ENV
- name: Setup | Go
uses: actions/setup-go@v3
- name: Setup | Install git-chglog
run: go install github.com/git-chglog/git-chglog/cmd/git-chglog@latest
- name: Generate changelog
run: |
/home/runner/go/bin/git-chglog --next-tag ${{ env.Version }} ${{ env.Version }}| tee RELEASE_NOTE.md
/home/runner/go/bin/git-chglog --next-tag ${{ env.Version }} ..${{ env.Version }} | tee CHANGELOG.md
- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: master
commit_message: 'doc: update CHANGELOG.md for ${{ env.Version }} [skip ci]'
file_pattern: CHANGELOG.md
- name: Post comments
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
URL: ${{ github.event.pull_request.html_url }}
run:
gh pr comment -F RELEASE_NOTE.md "${URL}"
- name: Upload CHANGELOG-${{ env.Version }}.md
uses: actions/upload-artifact@v3
with:
name: release-note
path: RELEASE_NOTE.md
- name: Upload CHANGELOG.md
uses: actions/upload-artifact@v3
with:
name: changelog-all
path: CHANGELOG.md