-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (62 loc) · 2.16 KB
/
cd.yaml
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
67
68
69
70
71
72
73
74
75
76
name: CD
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for changelog and tag
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12' # Adjust to your project's Python version
- name: Install Poetry
run: pip install poetry
- name: Configure Poetry to use the same Python version as setup-python
run: poetry env use $(python -c "import sys; print(sys.executable)")
- name: Install dependencies
run: poetry install
- name: Install Git Chglog
run: |
curl -sSL https://git.io/install-git-chglog | bash -s -- -b /usr/local/bin
git-chglog --version
- name: Generate Changelog
run: git-chglog -o CHANGELOG.md
- name: Commit Changelog
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add CHANGELOG.md
git commit -m "chore: update changelog"
- name: Bump version and tag
id: tag
run: |
VERSION=$(poetry version -s)
NEW_TAG=v$(echo $VERSION | awk -F. '{$NF += 1; OFS="."; print}')
echo "Bumping tag to $NEW_TAG"
git tag $NEW_TAG
git push origin $NEW_TAG
git push origin master
echo "::set-output name=new_tag::$NEW_TAG"
- name: Push changes
run: git push origin master
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: poetry publish --build --username __token__ --password $POETRY_PYPI_TOKEN
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.new_tag }}
release_name: Release ${{ steps.tag.outputs.new_tag }}
draft: false
prerelease: false
body: |
See the changelog for details.