Skip to content

Commit 8d6d9f5

Browse files
authored
Merge pull request #101 from PerformanceEstimation/workflow/automatic_push_to_pypi
Setup workflow to automatically upload releases to PyPI
2 parents 80958bc + 6e52303 commit 8d6d9f5

File tree

4 files changed

+47
-1
lines changed

4 files changed

+47
-1
lines changed

.github/workflows/execute_notebook.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ jobs:
4040
pip install lxml_html_clean
4141
pip install -r requirements.txt
4242
pip install mosek
43+
- name: Update version in setup.py
44+
run: >-
45+
sed -i "s/{{VERSION_PLACEHOLDER}}/0.0.0/g" setup.py
4346
- name: Install PEPit
4447
run: |
4548
pip install -e .
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish Python 🐍 distributions 📦 to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build-n-publish:
10+
name: Build and publish Python 🐍 distributions 📦 to PyPI
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@master
14+
- name: Set up Python 3.10
15+
uses: actions/setup-python@v3
16+
with:
17+
python-version: '3.10'
18+
- name: Install pypa/setuptools
19+
run: >-
20+
python -m
21+
pip install wheel
22+
- name: Extract tag name
23+
id: tag
24+
run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3)
25+
- name: Update version in setup.py
26+
run: >-
27+
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" setup.py
28+
- name: Build a binary wheel
29+
run: >-
30+
python setup.py sdist bdist_wheel
31+
- name: Publish distribution 📦 to PyPI
32+
uses: pypa/gh-action-pypi-publish@master
33+
with:
34+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/tests.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ jobs:
4040
python -m pip install --upgrade pip
4141
pip install -r requirements.txt
4242
pip install coverage
43+
- name: Update version in setup.py
44+
run: >-
45+
sed -i "s/{{VERSION_PLACEHOLDER}}/0.0.0/g" setup.py
4346
- name: Install PEPit
4447
run: |
4548
pip install -e .
@@ -75,6 +78,9 @@ jobs:
7578
python -m pip install --upgrade pip
7679
pip install -r requirements.txt
7780
pip install coverage
81+
- name: Update version in setup.py
82+
run: >-
83+
sed -i "s/{{VERSION_PLACEHOLDER}}/0.0.0/g" setup.py
7884
- name: Install PEPit
7985
run: |
8086
pip install -e .
@@ -105,6 +111,9 @@ jobs:
105111
python -m pip install --upgrade pip
106112
pip install -r requirements.txt
107113
pip install coverage
114+
- name: Update version in setup.py
115+
run: >-
116+
sed -i "s/{{VERSION_PLACEHOLDER}}/0.0.0/g" setup.py
108117
- name: Install PEPit
109118
run: |
110119
pip install -e .

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
with open("README.md", "r", encoding="utf-8") as fh:
44
long_description = fh.read()
55

6-
version = "0.3.3"
6+
version = "{{VERSION_PLACEHOLDER}}"
77

88
setuptools.setup(
99
name="PEPit",

0 commit comments

Comments
 (0)