Skip to content

Commit 00fcbe9

Browse files
committed
chore: Add changelog script
1 parent 0851b40 commit 00fcbe9

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: 'Generate Changelog'
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
Changelog:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: 'Checkout Git repository with history for all branches and tags'
14+
uses: actions/checkout@v2.3.4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: 'Set current Git tag'
19+
run: echo "CURRENT_TAG=$(git tag --points-at ${{github.sha}})" >> "$GITHUB_ENV"
20+
21+
- name: 'Set previous Git tag'
22+
run: echo "PREVIOUS_TAG=$(git describe --tags --abbrev=0 --exclude ${{env.CURRENT_TAG}})" >> "$GITHUB_ENV"
23+
24+
- name: 'Print environment variables'
25+
run: |
26+
echo -e "PREVIOUS_TAG = ${{env.PREVIOUS_TAG}}"
27+
echo -e "CURRENT_TAG = ${{env.CURRENT_TAG}}"
28+
echo -e "Node.js version = $(node --version)"
29+
30+
- name: 'Generate changelog'
31+
run: |
32+
echo "{}" > ./package.json
33+
npx generate-changelog@1.8.0 -t ${{env.PREVIOUS_TAG}}...${{env.CURRENT_TAG}}
34+
35+
- name: 'Attach changelog to tag'
36+
uses: softprops/action-gh-release@v1
37+
env:
38+
GITHUB_TOKEN: ${{github.token}}
39+
with:
40+
tag_name: ${{env.CURRENT_TAG}}
41+
name: ${{env.CURRENT_TAG}}
42+
body_path: ./CHANGELOG.md
43+
draft: false
44+
prerelease: false

0 commit comments

Comments
 (0)