-
-
Notifications
You must be signed in to change notification settings - Fork 6
80 lines (75 loc) · 2.53 KB
/
changelog.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
name: Changelog
on:
pull_request:
types: [closed]
jobs:
build:
runs-on: ubuntu-latest
if: startsWith(github.base_ref, 'release/') && github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false
token: ${{ github.token }}
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v4.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
fromTag: main
toTag: ${{ github.base_ref }}
outputFile: CHANGELOG.release.md
configurationJson: |
{
"pr_template": "- #{{TITLE}} (PR: ##{{NUMBER}})",
"categories": [
{
"title": "### 🚀 Features",
"labels": ["feature", "enhancement"]
},
{
"title": "### 🐛 Fixes",
"labels": ["fix", "hotfix", "bug"]
},
{
"title": "### 🧪 Test",
"labels": ["test"]
},
{
"title": "### 📦 General",
"labels": []
},
{
"title": "### 📖 Documentation",
"labels": ["doc"]
}
],
"label_extractor": [
{
"pattern": "(.*)/(.+)",
"on_property": "branch",
"target": "$1",
"flags": "gu"
}
]
}
- name: Create CHANGELOG.md
run: |
echo "## ${GITHUB_BASE_REF#release/}" > CHANGELOG.md.new
cat CHANGELOG.release.md | sed -e 's:## :### :g' >> CHANGELOG.md.new
echo "" >> CHANGELOG.md.new
git checkout origin/main -- CHANGELOG.md
cat CHANGELOG.md >> CHANGELOG.md.new;
mv CHANGELOG.md.new CHANGELOG.md
git config --global user.name $GITHUB_ACTOR
git config --global user.email $GITHUB_ACTOR@users.noreply.github.com
git add CHANGELOG.md
git add CHANGELOG.release.md
git commit -m "update changelogs"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: ${{ github.base_ref }}