Skip to content

Commit fb10e5a

Browse files
committed
.github/workflows/release: Update release file
1 parent 68f1738 commit fb10e5a

File tree

1 file changed

+36
-31
lines changed

1 file changed

+36
-31
lines changed

.github/workflows/release.yml

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,60 +24,65 @@ name: PyPI release
2424
# MOD_NAME: numpy
2525

2626
on:
27+
# For Github release-based publishing
28+
#release:
29+
# types: [published]
30+
# For tag-based (instead of Github-specific release-based):
2731
push:
2832
tags:
2933
- '*'
3034

3135
jobs:
32-
pypi:
36+
build:
3337
runs-on: ubuntu-latest
3438
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
39+
permissions:
40+
contents: read
3541

3642
steps:
37-
- uses: actions/checkout@v2
43+
- uses: actions/checkout@v4
3844

3945
- name: Set up Python
40-
uses: actions/setup-python@v2
46+
uses: actions/setup-python@v4
4147
#with:
4248
# python-version: 3.8
4349

4450
- name: Install dependencies
4551
run: |
4652
python -m pip install --upgrade pip
47-
pip install twine wheel
53+
pip install -r requirements.txt
54+
pip install twine wheel flit
4855
4956
- name: Build
5057
run: |
51-
python setup.py sdist bdist_wheel
58+
flit build
5259
5360
# Verify that the git tag has the same version as the python
5461
# project version.
55-
- name: Check that versions match
56-
run: |
57-
pip install .
58-
# If MOD_NAME not defined, infer it from the directory name
59-
if [ -z "$MOD_NAME" ] ; then
60-
# strip leading directories
61-
MOD_NAME=${PWD##*/}
62-
# replace '-' with '_'
63-
MOD_NAME=${MOD_NAME//-/_}
64-
fi
65-
# Find the versions
66-
MOD_VERSION=$(python -c "import $MOD_NAME ; print($MOD_NAME.__version__)")
67-
echo $MOD_VERSION
68-
TAG_VERSION=${{ github.ref }}
69-
echo $TAG_VERSION
70-
TAG_VERSION=${TAG_VERSION##refs/tags/} # remove leading 'refs/tags/'
71-
# Do the actual check
72-
if [ "$MOD_VERSION" != "$TAG_VERSION" ] ; then
73-
echo "::error::Module version ($MOD_VERSION) des not match tag version ($TAG_VERSION)"
74-
exit 1
75-
fi
62+
- uses: rkdarst/action-verify-python-version@main
7663

77-
- name: Publish on PyPI
78-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
79-
uses: pypa/gh-action-pypi-publish@v1.4.1
64+
- uses: actions/upload-artifact@v4
65+
with:
66+
name: dist-directory
67+
path: dist/
68+
69+
70+
upload:
71+
runs-on: ubuntu-latest
72+
needs: build
73+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
74+
permissions:
75+
id-token: write # for trusted publishing
76+
steps:
77+
78+
- uses: actions/download-artifact@v4
8079
with:
81-
user: __token__
82-
password: ${{ secrets.pypi_password }}
80+
name: dist-directory
81+
path: dist/
82+
83+
- name: Publish on PyPI
84+
uses: pypa/gh-action-pypi-publish@release/v1
85+
#with:
86+
#user: __token__
87+
#password: ${{ secrets.pypi_password }}
8388
#repository_url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)