forked from microsoft/autogen
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (58 loc) · 1.83 KB
/
python-package.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Upload Python Package to PyPi
on:
push:
branches:
- cmbagent
workflow_dispatch:
release:
types: [published]
permissions: # Ensure the workflow has permission to push changes
contents: write # Allow write access for pushing to the repository
jobs:
bump_version:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
persist-credentials: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install bump2version
run: python -m pip install bump2version
- name: Bump version (patch)
run: |
bump2version patch --current-version $(grep -Eo '__version__ = "[^"]*' cmbagent_autogen/version.py | cut -d'"' -f2) cmbagent_autogen/version.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit and push version bump
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add cmbagent_autogen/version.py
git commit -m "Bump version"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
needs: bump_version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}