Skip to content

Commit 109c761

Browse files
feat(changelog): Add automatic changelog generation step in build workflow
1 parent a494dff commit 109c761

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,44 @@ env:
88
IMAGE_NAME: pasarguard/${{ github.event.repository.name }}
99

1010
jobs:
11+
generate-changelog:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Determine version range
20+
id: tags
21+
run: |
22+
current_tag="${GITHUB_REF_NAME}"
23+
prev_tag="$(git describe --tags --abbrev=0 "${current_tag}^" 2>/dev/null || true)"
24+
if [ -z "$prev_tag" ]; then
25+
prev_tag="$(git rev-list --max-parents=0 HEAD)"
26+
fi
27+
echo "previous=$prev_tag" >> "$GITHUB_OUTPUT"
28+
echo "current=$current_tag" >> "$GITHUB_OUTPUT"
29+
30+
- name: Setup Bun
31+
uses: oven-sh/setup-bun@v2
32+
with:
33+
bun-version: latest
34+
35+
- name: Generate changelog
36+
run: |
37+
bunx changelogen@latest --from "${{ steps.tags.outputs.previous }}" --to "${{ steps.tags.outputs.current }}" \
38+
| grep -v "Generating changelog for " > CHANGELOG.md
39+
40+
- name: Upload changelog artifact
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: changelog
44+
path: CHANGELOG.md
45+
retention-days: 7
46+
1147
build-dashboard:
48+
needs: generate-changelog
1249
runs-on: ubuntu-latest
1350
steps:
1451
- name: Checkout

0 commit comments

Comments
 (0)