diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c82951a..2ab1faf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,6 +18,8 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + pages: write + id-token: write steps: - name: Checkout code @@ -59,10 +61,42 @@ jobs: env: GH_TOKEN: ${{ github.token }} + - name: Create pypi-index directory + if: steps.bump.outputs.bumped == 'true' + run: | + mkdir -p pypi-index + cp target/wheels/*.whl pypi-index/ + + - name: Generate PyPI index with dumb-pypi + if: steps.bump.outputs.bumped == 'true' + run: | + 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 }}/ + + - name: Setup Pages + if: steps.bump.outputs.bumped == 'true' + uses: actions/configure-pages@v5 + + - name: Upload Pages artifact + if: steps.bump.outputs.bumped == 'true' + uses: actions/upload-pages-artifact@v3 + with: + path: pypi-index + + - name: Deploy to Github Pages + if: steps.bump.outputs.bumped == 'true' + id: deployment + uses: actions/deploy-pages@v4 + + - name: Commit pypi-index to repository + if: steps.bump.outputs.bumped == 'true' + run: | + git add pypi-index + git commit -m "Add PyPI index for ${{ steps.bump.outputs.git-tag }}" + git push origin HEAD:${{ github.ref }} + - name: Push bumped version if: steps.bump.outputs.bumped == 'true' run: | - target_ref=${{ github.head_ref && format('refs/heads/{0}', github.head_ref) || github.ref }} git push origin HEAD:${{ github.ref }} git push origin ${{ steps.bump.outputs.git-tag }} diff --git a/.gitignore b/.gitignore index 56124a8..b1176a7 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ work/ build/bdist.* build/lib /dist/ +# Keep pypi-index for GitHub Pages serving +!/pypi-index