@@ -2,25 +2,23 @@ name: Publish libeCalc package to PyPI
22
33on :
44 workflow_call :
5- secrets :
6- PYPI_TOKEN :
7- required : true
8-
9- workflow_dispatch : # Trigger manually, if needed
10-
11- permissions :
12- packages : write
13- contents : read
14- id-token : write
5+ workflow_dispatch :
156
167jobs :
178 publish :
9+ environment :
10+ name : pypi
11+ url : https://pypi.org/project/libecalc/
12+ # name: testpypi
13+ # url: https://test.pypi.org/p/libecalc # NOTE: If/when we need to test publishing etc to PyPI, we can use Test PyPI
14+ permissions :
15+ id-token : write # Required for Trusted Publishing to PyPI, the pypa action uses this
1816 runs-on : ubuntu-24.04
1917 steps :
2018 - name : Checkout code
2119 uses : actions/checkout@v4
2220 with :
23- # Make sure we publish from main branch, not the triggering ref
21+ # NOTE: Make sure we publish from main branch, not the triggering ref
2422 ref : ${{ github.event.repository.default_branch }}
2523
2624 - name : Setup Python 3.11
@@ -33,26 +31,12 @@ jobs:
3331 version : 1.8.4
3432 virtualenvs-create : true
3533
36- - name : Check pyproject.toml validity
37- run : poetry check --no-interaction
38-
39- - name : Cache dependencies
40- id : cache-deps
41- uses : actions/cache@v4
42- with :
43- path : ${{github.workspace}}/.venv
44- key : poetry-${{ hashFiles('**/poetry.lock') }}
45- restore-keys : poetry-
46-
47- - name : Install dependencies # if cache has changed
48- if : steps.cache-deps.cache-hit != 'true'
34+ - name : Build the libecalc package (wheel and sdist by default)
4935 run : |
50- poetry config virtualenvs.in-project true
51- poetry install --no-interaction
36+ poetry build
5237
5338 - name : Publish to PyPI
54- env :
55- PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
56- run : |
57- poetry config pypi-token.pypi $PYPI_TOKEN
58- poetry publish --build
39+ uses : pypa/gh-action-pypi-publish@release/v1
40+ with :
41+ # repository-url: https://test.pypi.org/legacy/ # NOTE: Only needed to specify for Test PyPI
42+ packages-dir : dist/
0 commit comments