Skip to content

Commit fb13d42

Browse files
committed
ci: fix release, automated changelog, hopefully, removed
1 parent 4f8791f commit fb13d42

File tree

3 files changed

+78
-54
lines changed

3 files changed

+78
-54
lines changed

.github/release-drafter.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,51 @@
1-
name: Release Drafter
1+
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- "v*" # Only trigger when tags starting with 'v' are pushed
7-
8-
permissions:
9-
contents: write
4+
workflow_run:
5+
workflows: ["Build"]
6+
types:
7+
- completed
108

119
jobs:
12-
update_release_draft:
13-
permissions:
14-
contents: write # Required to create/update GitHub releases
15-
pull-requests: write # Required for autolabeler
10+
changelog_release:
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1612
runs-on: ubuntu-latest
1713
steps:
18-
# Drafts release notes when tags are pushed from release.sh
19-
- uses: release-drafter/release-drafter@v6
14+
- uses: actions/checkout@v4
2015
with:
21-
tag: ${{ github.ref_name }} # Use the pushed tag name
16+
fetch-depth: 0 # full history needed for changelog
17+
18+
- name: Install git-cliff
19+
run: |
20+
curl -sSL https://github.com/orhun/git-cliff/releases/download/v2.1.2/git-cliff-2.1.2-x86_64-unknown-linux-musl.tar.gz | tar xz
21+
sudo mv git-cliff /usr/local/bin/
22+
23+
- name: Generate CHANGELOG.md
24+
run: git-cliff -c git-cliff.toml -o CHANGELOG.md
25+
26+
- name: Commit and push CHANGELOG.md
27+
run: |
28+
git config --global user.email "bot@users.noreply.github.com"
29+
git config --global user.name "GitHub Actions Bot"
30+
git add CHANGELOG.md
31+
git commit -m "Update CHANGELOG.md for ${{ github.ref_name }}"
32+
git push
2233
env:
2334
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Download build artifacts
37+
uses: actions/download-artifact@v4
38+
with:
39+
path: artifacts
40+
41+
- name: Create GitHub Release
42+
uses: softprops/action-gh-release@v1
43+
with:
44+
tag_name: ${{ github.ref_name }}
45+
name: Release ${{ github.ref_name }}
46+
body_path: CHANGELOG.md
47+
draft: true
48+
files: artifacts/**/*
49+
prerelease: ${{ contains(github.ref_name, '-') }}
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

git-cliff.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[git]
2+
tag_pattern = "v[0-9]+.[0-9]+.[0-9]+.*"
3+
4+
[changelog]
5+
header = """
6+
# Changelog
7+
8+
All notable changes to this project will be documented in this file.
9+
10+
"""
11+
body = """
12+
{% for group, commits in commits | group_by_attribute("group") %}
13+
### {{ group | upper_first }}
14+
15+
{% for commit in commits %}
16+
- {{ commit.message | strip_trailing_dot }} ([{{ commit.id | truncate(7, "") }}]({{ commit.commit_link }}))
17+
{% endfor %}
18+
{% endfor %}
19+
"""
20+
21+
footer = """
22+
---
23+
Generated by [git-cliff](https://github.com/orhun/git-cliff).
24+
"""
25+
26+
[commit_types]
27+
feat = { group = "Features" }
28+
fix = { group = "Bug Fixes" }
29+
docs = { group = "Documentation" }
30+
style = { group = "Styling" }
31+
refactor = { group = "Refactoring" }
32+
perf = { group = "Performance" }
33+
test = { group = "Testing" }
34+
chore = { group = "Chores" }
35+
build = { group = "Build System" }
36+
ci = { group = "Continuous Integration" }

0 commit comments

Comments
 (0)