Skip to content

Commit 2ce1174

Browse files
Use trusted publisher workflow for pypi release (#39)
1 parent d208317 commit 2ce1174

File tree

1 file changed

+37
-26
lines changed

1 file changed

+37
-26
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,51 @@ on:
88
jobs:
99
release-job:
1010
runs-on: ubuntu-latest
11-
env:
12-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
1311
steps:
14-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
15-
- name: Set up Python
16-
uses: actions/setup-python@v5
17-
with:
18-
python-version: 3.12
19-
- name: Install release tooling
20-
run: |
21-
pip install twine wheel numpy setuptools versioneer
22-
- name: Build package
23-
run: |
24-
python setup.py sdist bdist_wheel
25-
- name: Check version number match
26-
run: |
27-
echo "GITHUB_REF: ${GITHUB_REF}"
28-
# The GITHUB_REF should be something like "refs/tags/v1.2.3"
29-
# Make sure the package version is the same as the tag
30-
grep -Rq "^Version: ${GITHUB_REF:11}$" gEconpy.egg-info/PKG-INFO
31-
- name: Publish to PyPI
32-
run: |
33-
twine check dist/*
34-
twine upload --repository pypi --username __token__ --password ${PYPI_TOKEN} dist/*
35-
test-install-job:
12+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: 3.12
17+
- name: Install release tooling
18+
run: |
19+
pip install twine wheel numpy setuptools versioneer
20+
- name: Build package
21+
run: |
22+
python setup.py sdist bdist_wheel
23+
- name: Check version number match
24+
run: |
25+
echo "GITHUB_REF: ${GITHUB_REF}"
26+
# The GITHUB_REF should be something like "refs/tags/v1.2.3"
27+
# Make sure the package version is the same as the tag
28+
grep -Rq "^Version: ${GITHUB_REF:11}$" gEconpy.egg-info/PKG-INFO
29+
- uses: actions/upload-artifact@v4
30+
with:
31+
name: bdist
32+
path: dist/*
33+
pypi-publish:
3634
needs: release-job
35+
name: upload release to PyPI
36+
runs-on: ubuntu-latest
37+
permissions:
38+
id-token: write
39+
steps:
40+
- uses: actions/download-artifact@v4
41+
with:
42+
name: bdist
43+
path: dist
44+
- name: Publish package distributions to PyPI
45+
uses: pypa/gh-action-pypi-publish@release/v1
46+
test-install-job:
47+
needs: pypi-publish
3748
runs-on: ubuntu-latest
3849
steps:
3950
- name: Set up Python
4051
uses: actions/setup-python@v5
4152
with:
42-
python-version: 3.7
53+
python-version: 3.12
4354
- name: Give PyPI a chance to update the index
44-
run: sleep 240
55+
run: sleep 360
4556
- name: Install from PyPI
4657
run: |
4758
pip install gEconpy==${GITHUB_REF:11}

0 commit comments

Comments
 (0)