Skip to content

Commit 44749a0

Browse files
committed
github actions
1 parent 4f84fd2 commit 44749a0

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/main.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
push:
7+
branches: [master]
8+
pull_request:
9+
branches: [master]
10+
11+
jobs:
12+
release-build:
13+
if: github.event_name != 'pull_request'
14+
runs-on: ubuntu-latest
15+
permissions:
16+
id-token: write
17+
contents: write
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.12"
25+
26+
- name: Build release distributions
27+
run: |
28+
# NOTE: put your own distribution build steps here.
29+
python -m pip install -e .
30+
python -m pip install build
31+
python -m build
32+
33+
- name: Publish release distributions to PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1
35+
with:
36+
packages-dir: dist/
37+
- name: Bump version
38+
if: github.event_name == 'release'
39+
run: |
40+
git config --global user.name 'ProjectBot'
41+
git config --global user.email '[email protected]'
42+
VERSION=${{ github.event.release.tag_name }} && VERSION=${VERSION/v/}
43+
VERSION=`echo $VERSION | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.`
44+
sed -ie "s/version = .*/version = \"$VERSION\"/" pyproject.toml
45+
git add pyproject.toml
46+
git commit -m 'auto bump version with release'
47+
git push

0 commit comments

Comments
 (0)