Skip to content

Commit 94af5d1

Browse files
committed
Add workflow to publish package
1 parent 692d7f9 commit 94af5d1

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

.github/workflows/publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
deployments: write
10+
packages: write
11+
repository-projects: read
12+
contents: read
13+
id-token: write
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
# Checkout the code
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
# Set up Python
24+
- name: Set up Python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: '3.10'
28+
29+
# Install dependencies
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install setuptools wheel twine
34+
35+
# Build the distribution
36+
- name: Build distribution
37+
run: |
38+
CURRENT_TAG=$(git describe --tags --abbrev=0)
39+
VERSION=${CURRENT_TAG#v} # Remove 'v' from the tag
40+
sed -i "s/version=\"[^\"]*\"/version=\"$VERSION\"/" setup.py
41+
python setup.py sdist bdist_wheel
42+
43+
# Upload the distribution to PyPI
44+
- name: Upload to PyPI
45+
run: |
46+
twine upload dist/*

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='adaup',
5-
version='0.1.0',
5+
version='0.1.1',
66
packages=['adaup'],
77
package_dir={'': 'src'},
88
install_requires=[

0 commit comments

Comments
 (0)