Skip to content

Commit 7ee5cbc

Browse files
authored
Publish wheel to pypi index static files in repository (#76)
* Remove unused var * Publish wheels to Github Pages * Fix dumb-pypi invocation
1 parent e18cd63 commit 7ee5cbc

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

‎.github/workflows/release.yml‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
runs-on: ubuntu-latest
1919
permissions:
2020
contents: write
21+
pages: write
22+
id-token: write
2123

2224
steps:
2325
- name: Checkout code
@@ -59,10 +61,42 @@ jobs:
5961
env:
6062
GH_TOKEN: ${{ github.token }}
6163

64+
- name: Create pypi-index directory
65+
if: steps.bump.outputs.bumped == 'true'
66+
run: |
67+
mkdir -p pypi-index
68+
cp target/wheels/*.whl pypi-index/
69+
70+
- name: Generate PyPI index with dumb-pypi
71+
if: steps.bump.outputs.bumped == 'true'
72+
run: |
73+
uvx dumb-pypi --package-list <(cd ./pypi-index && ls *.whl) --output-dir pypi-index --packages-url https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/
74+
75+
- name: Setup Pages
76+
if: steps.bump.outputs.bumped == 'true'
77+
uses: actions/configure-pages@v5
78+
79+
- name: Upload Pages artifact
80+
if: steps.bump.outputs.bumped == 'true'
81+
uses: actions/upload-pages-artifact@v3
82+
with:
83+
path: pypi-index
84+
85+
- name: Deploy to Github Pages
86+
if: steps.bump.outputs.bumped == 'true'
87+
id: deployment
88+
uses: actions/deploy-pages@v4
89+
90+
- name: Commit pypi-index to repository
91+
if: steps.bump.outputs.bumped == 'true'
92+
run: |
93+
git add pypi-index
94+
git commit -m "Add PyPI index for ${{ steps.bump.outputs.git-tag }}"
95+
git push origin HEAD:${{ github.ref }}
96+
6297
- name: Push bumped version
6398
if: steps.bump.outputs.bumped == 'true'
6499
run: |
65-
target_ref=${{ github.head_ref && format('refs/heads/{0}', github.head_ref) || github.ref }}
66100
git push origin HEAD:${{ github.ref }}
67101
git push origin ${{ steps.bump.outputs.git-tag }}
68102

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ work/
44
build/bdist.*
55
build/lib
66
/dist/
7+
# Keep pypi-index for GitHub Pages serving
8+
!/pypi-index

0 commit comments

Comments
 (0)