1- name : Test
1+ name : Test-Publish
22
33on :
44 push :
55 branches : ['master']
6+ tags :
7+ - ' v*' # only publish when pushing version tags (e.g., v1.0.0)
68 pull_request :
79 workflow_dispatch :
810
@@ -12,22 +14,22 @@ jobs:
1214 timeout-minutes : 30
1315 strategy :
1416 matrix :
15- python-version : ['3.10', '3.12']
17+ python-version : ['3.10', '3.12', '3.13' ]
1618 os : ['ubuntu-latest', 'windows-latest']
17- omc-version : ['stable']
19+ omc-version : ['stable', 'nightly' ]
1820
1921 steps :
2022 - uses : actions/checkout@v5
2123
2224 - name : Set up Python ${{ matrix.python-version }}
23- uses : actions/setup-python@v5
25+ uses : actions/setup-python@v6
2426 with :
2527 python-version : ${{ matrix.python-version }}
2628 architecture : ' x64'
2729
2830 - name : Install dependencies
2931 run : |
30- python -m pip install --upgrade pip
32+ python -m pip install --upgrade pip build setuptools wheel twine
3133 pip install . pytest pytest-md pytest-emoji pre-commit
3234
3335 - name : Set timezone
3941 run : ' pre-commit run --all-files'
4042
4143 - name : " Set up OpenModelica Compiler"
42- uses : OpenModelica/setup-openmodelica@v1.0
44+ uses : OpenModelica/setup-openmodelica@v1.0.2
4345 with :
4446 version : ${{ matrix.omc-version }}
4547 packages : |
5254 if : runner.os != 'Windows'
5355 run : docker pull openmodelica/openmodelica:v1.25.0-minimal
5456
57+ - name : Build wheel and sdist packages
58+ run : python -m build --wheel --sdist --outdir dist
59+
60+ - name : Check twine
61+ run : python -m twine check dist/*
62+
5563 - name : Run pytest
5664 uses : pavelzw/pytest-action@v2
5765 with :
6169 custom-arguments : ' -v '
6270 click-to-expand : true
6371 report-title : ' Test Report'
72+
73+ Publish :
74+ name : Publish to PyPI
75+ runs-on : ${{ matrix.os }}
76+ needs : test
77+ strategy :
78+ matrix :
79+ python-version : ['3.10']
80+ os : ['ubuntu-latest']
81+ if : startsWith(github.ref, 'refs/tags/')
82+ steps :
83+ - uses : actions/checkout@v5
84+
85+ - name : Set up Python ${{ matrix.python-version }}
86+ uses : actions/setup-python@v6
87+ with :
88+ python-version : ${{ matrix.python-version }}
89+ architecture : ' x64'
90+
91+ - name : Install dependencies
92+ run : |
93+ python -m pip install --upgrade pip build setuptools wheel twine
94+
95+ - name : Build wheel and sdist packages
96+ run : python -m build --wheel --sdist --outdir dist
97+
98+ - name : Publish wheel and sdist packages to PyPI
99+ env :
100+ TWINE_USERNAME : __token__
101+ TWINE_PASSWORD : ${{ secrets.PYPI_OMPYTHON_API_TOKEN }}
102+ run : |
103+ python -m twine upload dist/* --skip-existing
0 commit comments