Skip to content

Commit e1ccb48

Browse files
committed
refactor: move changelog generation to build step
1 parent 302de9d commit e1ccb48

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

.github/workflows/cd-publish.yml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
steps:
2020
- name: "[INIT] Checkout repository"
2121
uses: actions/checkout@v5
22+
with:
23+
fetch-depth: 0
2224

2325
- name: "[INIT] Install Nix"
2426
uses: cachix/install-nix-action@v31
@@ -42,10 +44,15 @@ jobs:
4244
nix build -L .#sdist
4345
cp result/*.tar.gz ./
4446
47+
- name: "[CHANGELOG] Generate changelog"
48+
run: |
49+
nix develop --command git-cliff -c cliff.toml -o CHANGELOG.md --verbose
50+
4551
- name: "[VERIFY] List built artifacts"
4652
run: |
4753
ls -la *.whl *.tar.gz
4854
echo "Built artifacts:"
55+
echo "- CHANGELOG.md"
4956
echo "- $(ls *.whl)"
5057
echo "- $(ls *.tar.gz)"
5158
@@ -56,6 +63,7 @@ jobs:
5663
path: |
5764
*.whl
5865
*.tar.gz
66+
CHANGELOG.md
5967
if-no-files-found: error
6068

6169
github-release:
@@ -67,8 +75,6 @@ jobs:
6775
steps:
6876
- name: "[INIT] Checkout repository"
6977
uses: actions/checkout@v5
70-
with:
71-
fetch-depth: 0
7278

7379
- name: "[DOWNLOAD] Get built artifacts"
7480
uses: actions/download-artifact@v4
@@ -82,28 +88,16 @@ jobs:
8288
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
8389
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
8490
85-
- name: "[CHANGELOG] Generate changelog"
86-
uses: orhun/git-cliff-action@v4
87-
with:
88-
config: cliff.toml
89-
args: --verbose
90-
env:
91-
OUTPUT: CHANGELOG.md
92-
GITHUB_REPO: ${{ github.repository }}
93-
94-
- name: "[CHANGELOG] Generate changelog"
95-
run: |
96-
nix develop --command git-cliff -c cliff.toml -o CHANGELOG.md --verbose
97-
9891
- name: "[CHANGELOG] Commit changelog"
9992
run: |
10093
git checkout main
10194
git config user.name 'github-actions[bot]'
10295
git config user.email 'github-actions[bot]@users.noreply.github.com'
10396
set +e
97+
mv ./dist/CHANGELOG.md ./CHANGELOG.md
10498
git add CHANGELOG.md
10599
git commit -m 'chore(release): update changelog for ${{ steps.version.outputs.tag }}'
106-
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git <branch>
100+
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git main
107101
108102
- name: "[RELEASE] Create GitHub release"
109103
uses: softprops/action-gh-release@v2

0 commit comments

Comments
 (0)