Skip to content

Commit 4050a70

Browse files
Aligned all GitHub Actions & Workflows to improve consistency and maintainability.
1 parent 50f82a6 commit 4050a70

4 files changed

Lines changed: 117 additions & 43 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717

18-
- uses: actions/setup-python@v4
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
1920
with:
2021
# For performance and compatibility with linters, using the latest Python version
2122
python-version: "3.12"
@@ -47,7 +48,8 @@ jobs:
4748
steps:
4849
- uses: actions/checkout@v4
4950

50-
- uses: actions/setup-python@v4
51+
- name: Set up Python
52+
uses: actions/setup-python@v4
5153
with:
5254
python-version: ${{ matrix.python-version }}
5355
cache: 'pip'
@@ -78,24 +80,25 @@ jobs:
7880
steps:
7981
- uses: actions/checkout@v4
8082

81-
- uses: actions/setup-python@v4
83+
- name: Set up Python
84+
uses: actions/setup-python@v4
8285
with:
8386
# For performance reasons, using the latest Python version
8487
python-version: "3.12"
8588
cache: 'pip'
8689

87-
- name: Install build tools
90+
- name: Install dependencies
8891
run: |
8992
python -m pip install --upgrade pip
9093
pip install ".[build]"
9194
92-
- name: Build distribution
95+
- name: Build package
9396
run: python -m build
9497

95-
- name: Verify distribution with twine
98+
- name: Verify package integrity
9699
run: twine check dist/*
97100

98-
- name: Upload distribution artifacts
101+
- name: Upload build artifacts
99102
uses: actions/upload-artifact@v4
100103
with:
101104
name: python-dist

.github/workflows/publish-test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish to TestPyPI
2+
3+
on:
4+
workflow_dispatch: # Manual trigger only
5+
6+
jobs:
7+
publish_test:
8+
name: Publish to TestPyPI
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: "3.12"
17+
cache: 'pip'
18+
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install ".[build]"
23+
24+
- name: Build package
25+
run: python -m build
26+
27+
- name: Verify package integrity
28+
run: twine check dist/*
29+
30+
- name: Upload test artifacts
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: testpypi-${{ github.run_number }}-${{ github.ref_name }}
34+
path: dist/
35+
retention-days: 7
36+
37+
- name: Publish to TestPyPI
38+
env:
39+
TWINE_USERNAME: __token__
40+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
41+
run: |
42+
twine upload --repository testpypi dist/*
43+
44+
- name: Wait for TestPyPI indexing
45+
run: |
46+
echo "Waiting for TestPyPI to index the package..."
47+
sleep 30
48+
49+
- name: Verify published versions
50+
run: |
51+
echo "Available versions:"
52+
pip index versions --index-url https://test.pypi.org/ wiley-tdm
53+
54+

.github/workflows/publish.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
name: Publish to PyPI
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: "3.12"
18+
cache: 'pip'
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install ".[build]"
24+
25+
- name: Build package
26+
run: python -m build
27+
28+
- name: Verify package integrity
29+
run: twine check dist/*
30+
31+
- name: Upload release artifacts
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: release-dist-${{ github.ref_name }}
35+
path: dist/
36+
retention-days: 30 # Keep release artifacts longer
37+
38+
- name: Publish to PyPI
39+
env:
40+
TWINE_USERNAME: __token__
41+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
42+
run: |
43+
twine upload --repository pypi dist/*
44+
45+
- name: Wait for PyPI indexing
46+
run: |
47+
echo "Waiting for PyPI to index the package..."
48+
sleep 30
49+
50+
- name: Verify published versions
51+
run: |
52+
echo "Available versions:"
53+
pip index versions --index-url https://pypi.org/ wiley-tdm

.github/workflows/test-release.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)