-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (57 loc) · 2.14 KB
/
Copy pathrelease.yaml
File metadata and controls
66 lines (57 loc) · 2.14 KB
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
name: Automated Release
on:
push:
branches:
- main # Triggers when code is merged into main
jobs:
release:
name: Generate Changelog & Release
runs-on: ubuntu-latest
permissions:
contents: write # Crucial: Allows the bot to push changes and create releases
steps:
- name: Checkout Code
uses: actions/checkout@v7
with:
fetch-depth: 0 # Fetches all history so git-cliff can read past commits
- name: Setup Git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# 1. Use git-cliff to calculate the next version number based on semantic commits
- name: Determine Next Version
id: next_version
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --bump
# 2. Generate the actual changelog text for this specific release
- name: Generate Changelog
id: git_cliff
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --verbose --bump --unreleased --strip all
# 3. Update CHANGELOG.md in the repository with the complete history including the new version
- name: Update CHANGELOG.md
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --bump --output CHANGELOG.md
# 4. Commit and Push CHANGELOG.md
- name: Commit and Push CHANGELOG.md
run: |
git add CHANGELOG.md
git commit -m "chore(release): prepare for ${{ steps.next_version.outputs.version }} [skip ci]" || echo "No changes to commit"
git push origin main
# 5. Create the GitHub Release and paste the changelog into it
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.next_version.outputs.version }}
name: Release ${{ steps.next_version.outputs.version }}
body: ${{ steps.git_cliff.outputs.content }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}