-
-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (52 loc) · 1.6 KB
/
cd.yml
File metadata and controls
61 lines (52 loc) · 1.6 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
name: Continuous Deployment
on:
workflow_dispatch:
push:
tags:
- 'v*'
release:
types: [published]
jobs:
generate-changelog:
name: Generate changelog
runs-on: ubuntu-22.04
permissions:
contents: write
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@main
id: git-cliff
with:
config: pyproject.toml
args: -vv --latest --strip header
- name: Fetch latest main
run: git fetch origin main
- name: Create worktree for changelog
run: git worktree add worktree-changelog origin/main
- name: Generate changelog in worktree
working-directory: worktree-changelog
uses: orhun/git-cliff-action@main
with:
config: pyproject.toml
args: -vv --latest --strip header --output docs/changelog.rst
- name: Commit and push changelog
working-directory: worktree-changelog
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add docs/changelog.rst
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "docs: update changelog [skip ci]"
git push origin HEAD:main
fi
- name: Cleanup worktree
if: always()
run: git worktree remove worktree-changelog || true