-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (44 loc) · 1.52 KB
/
release_pypi.yml
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
name: Publish to PyPI
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine setuptools wheel
- name: Update version
run: |
# Get commit count since last tag
COMMIT_COUNT=$(git rev-list --count HEAD)
# Create new version with commit count
NEW_VERSION="0.1.${COMMIT_COUNT}"
# Update version in __init__.py
sed -i "s/__version__ = \".*\"/__version__ = \"${NEW_VERSION}\"/" llm_dialog_manager/__init__.py
# Update version in pyproject.toml
sed -i "s/version = \".*\"/version = \"${NEW_VERSION}\"/" pyproject.toml
# Commit the version update
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add llm_dialog_manager/__init__.py pyproject.toml
git commit -m "Bump version to ${NEW_VERSION}"
git push
- name: Build package
run: python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*