Skip to content

Commit 7d7437d

Browse files
authored
Merge pull request #12 from dmgav/pypi-publish
Fixed workflow for publishing to PyPI.
2 parents f4b6c15 + 7bd7539 commit 7d7437d

File tree

2 files changed

+76
-9
lines changed

2 files changed

+76
-9
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish to PyPI - Test Wheels
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_and_test_wheels:
7+
runs-on: ubuntu-latest
8+
environment: release
9+
strategy:
10+
matrix:
11+
python-version: ["3.12"]
12+
13+
steps:
14+
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
# Need this to get version number from last tag
19+
fetch-depth: 0
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v6
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Build sdist and wheel
27+
run: >
28+
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) &&
29+
pipx run build
30+
31+
- name: Check for packaging errors
32+
run: pipx run twine check --strict dist/*
33+
34+
- name: Install produced wheel
35+
run: pip install dist/*.whl
36+
37+
- name: Test module is importable using the installed wheel - 1
38+
run: python -c "import save_and_restore_api"
39+
40+
- name: Test module is importable using the installed wheel - 2
41+
run: python -c "from save_and_restore_api import SaveRestoreAPI"
42+
43+
- name: Test module is importable using the installed wheel - 3
44+
run: python -c "from save_and_restore_api.aio import SaveRestoreAPI"
45+
46+
- name: Test if save-and-restore tools can be started
47+
run: save-and-restore -h

.github/workflows/publish-pypi.yml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,42 @@
11
name: Publish to PyPI
22

33
on:
4-
release:
5-
types: [created]
6-
branches:
7-
- main
4+
release:
5+
types: [created]
6+
branches:
7+
- main
88

99
jobs:
10-
upload:
10+
build_and_upload_to_pypi:
1111
runs-on: ubuntu-latest
1212
environment: release
13+
strategy:
14+
matrix:
15+
python-version: ["3.12"]
1316

1417
steps:
15-
- name: Download dist artifact
16-
uses: actions/download-artifact@v4
18+
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
# Need this to get version number from last tag
23+
fetch-depth: 0
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v6
1727
with:
18-
name: dist
19-
path: dist
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Build sdist and wheel
31+
run: >
32+
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) &&
33+
pipx run build
34+
35+
- name: Check for packaging errors
36+
run: pipx run twine check --strict dist/*
37+
38+
- name: Install produced wheel
39+
run: pip install dist/*.whl
2040

2141
- name: Publish to PyPI using trusted publishing
2242
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)