Skip to content

Commit 6c2ffa8

Browse files
release.yml config
1 parent 06c78b1 commit 6c2ffa8

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,51 @@
1+
name: Release & Changelog
12

3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
21+
- name: Install changelog CLI
22+
run: npm install -g conventional-changelog-cli
23+
24+
- name: Generate changelog
25+
run: conventional-changelog -p angular -i CHANGELOG.md -s
26+
27+
- name: Commit changelog
28+
run: |
29+
git config user.name "github-actions"
30+
git config user.email "github-actions@github.com"
31+
git add CHANGELOG.md
32+
git commit -m "chore: update changelog for ${{ github.ref_name }}"
33+
git push origin HEAD:main
34+
35+
- name: Read changelog for current tag
36+
id: extract_changelog
37+
run: |
38+
TAG="${GITHUB_REF#refs/tags/}"
39+
CHANGELOG=$(awk "/## \${TAG#v}\/,/^## /" CHANGELOG.md | sed '$d')
40+
echo "changelog<<EOF" >> $GITHUB_OUTPUT
41+
echo "$CHANGELOG" >> $GITHUB_OUTPUT
42+
echo "EOF" >> $GITHUB_OUTPUT
43+
44+
- name: Create GitHub Release
45+
uses: softprops/action-gh-release@v2
46+
with:
47+
tag_name: ${{ github.ref_name }}
48+
name: Release ${{ github.ref_name }}
49+
body: ${{ steps.extract_changelog.outputs.changelog }}
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)