Skip to content

Commit d9fdd71

Browse files
committed
👷 Use github actions for pypi release
1 parent f27921c commit d9fdd71

File tree

2 files changed

+40
-24
lines changed

2 files changed

+40
-24
lines changed

‎.github/workflows/build.yaml‎

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,8 @@ jobs:
2626
'Modelica 4.0.0'
2727
2828
- run: "omc --version"
29-
# - name: Install OpenModelica
30-
# run: |
31-
# sudo apt-get update
32-
# sudo apt-get install ca-certificates curl gnupg
33-
# sudo curl -fsSL http://build.openmodelica.org/apt/openmodelica.asc | \
34-
# sudo gpg --dearmor -o /usr/share/keyrings/openmodelica-keyring.gpg
35-
# echo "deb [arch=amd64 signed-by=/usr/share/keyrings/openmodelica-keyring.gpg] \
36-
# https://build.openmodelica.org/apt \
37-
# $(cat /etc/os-release | grep "\(UBUNTU\\|DEBIAN\\|VERSION\)_CODENAME" | sort | cut -d= -f 2 | head -1) \
38-
# stable" | sudo tee /etc/apt/sources.list.d/openmodelica.list
39-
# sudo apt update
40-
# sudo apt install --no-install-recommends omc
41-
- uses: actions/checkout@v3
42-
- uses: actions/setup-python@v4
29+
- uses: actions/checkout@v4
30+
- uses: actions/setup-python@v5
4331
with:
4432
python-version: ${{ matrix.python }}
4533
- name: Run test
@@ -52,27 +40,54 @@ jobs:
5240
with:
5341
token: ${{ secrets.CODECOV_TOKEN }}
5442
files: ./coverage.xml
43+
build:
44+
name: Build package
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: actions/setup-python@v5
49+
with:
50+
python-version: "3.11"
51+
- name: Install pypa/build
52+
run: python -m pip install build
53+
- name: Build a binary wheel and a source tarball
54+
run: python -m build
55+
- name: Install twine
56+
run: python -m pip install twine
57+
- name: Check build
58+
run: python -m twine check --strict dist/*
59+
- name: Store the distribution packages
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: python-package-distributions
63+
path: dist/
5564
# this duplicates pre-commit.ci, so only run it on tags
5665
# it guarantees that linting is passing prior to a release
5766
lint-pre-release:
5867
if: startsWith(github.ref, 'refs/tags')
5968
runs-on: ubuntu-latest
6069
steps:
61-
- uses: actions/checkout@v4.0.0
70+
- uses: actions/checkout@v4
6271
- uses: actions/setup-python@v5
6372
with:
6473
python-version: "3.11"
6574
- run: python -m pip install tox
6675
- run: python -m tox -e lint
67-
release:
68-
needs: [ tests, lint-pre-release ]
76+
publish-to-pypi:
6977
name: PyPI release
70-
if: startsWith(github.ref, 'refs/tags')
78+
if: startsWith(github.ref, 'refs/tags/')
79+
needs: [ build, tests, lint-pre-release ]
7180
runs-on: ubuntu-latest
81+
environment:
82+
name: pypi
83+
url: https://pypi.org/p/modelitool
84+
permissions:
85+
id-token: write
7286
steps:
73-
- uses: actions/checkout@v3
74-
- uses: actions/setup-python@v4
75-
- run: python -m pip install --upgrade pip wheel
76-
- run: pip install twine
77-
- run: python setup.py sdist bdist_wheel
78-
- run: twine upload -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} dist/*
87+
- name: Download all the dists
88+
uses: actions/download-artifact@v4
89+
with:
90+
name: python-package-distributions
91+
path: dist/
92+
- name: Publish distribution to PyPI
93+
uses: pypa/gh-action-pypi-publish@release/v1

‎setup.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
version="0.1.0",
1313
description="Tools for Modelica",
1414
long_description=long_description,
15+
long_description_content_type="text/markdown",
1516
url="https://github.com/BuildingEnergySimulationTools/modelitool",
1617
author="Nobatek/INEF4",
1718
author_email="bdurandestebe@nobatek.com",

0 commit comments

Comments
 (0)