Fix open redirect with backslashes (#94) #17
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PyPI release π π¦ | |
on: | |
push: | |
tags: [v*] | |
jobs: | |
build: | |
name: Build package π¦ | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
name: Set up Python π | |
with: | |
python-version: '3.11' | |
- name: Check version π | |
run: python .github/utils/check_version.py "${GITHUB_REF#refs/tags/v}" | |
- name: Install build deps π§ | |
run: pip install --user build | |
- name: Build wheel and sdist π¦ | |
run: >- | |
python -m | |
build | |
--outdir dist/ | |
. | |
- uses: actions/upload-artifact@v4 | |
name: Upload build artifacts π¦ | |
with: | |
name: wheel | |
retention-days: 7 | |
path: ./dist | |
create-github-release: | |
name: Create GitHub release π | |
# Upload wheel to a GitHub release. It remains available as a build artifact for a while as well. | |
needs: build | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
name: Download build artifacts π¦ | |
- name: Create draft release π | |
run: >- | |
gh release create | |
--draft | |
--repo ${{ github.repository }} | |
--title ${{ github.ref_name }} | |
${{ github.ref_name }} | |
wheel/* | |
env: | |
GH_TOKEN: ${{ github.token }} | |
publish-pypi: | |
name: Publish π | |
needs: build | |
# Wait for approval before attempting to upload to PyPI. This allows reviewing the | |
# files in the draft release. | |
environment: publish | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
# Try uploading to Test PyPI first, in case something fails. | |
- name: Publish to Test PyPI π§ͺ | |
uses: pypa/[email protected] | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
packages-dir: wheel/ | |
- name: Publish to PyPI π | |
uses: pypa/[email protected] | |
with: | |
packages-dir: wheel/ | |
- name: Publish GitHub release π | |
run: >- | |
gh release edit | |
--draft=false | |
--repo ${{ github.repository }} | |
${{ github.ref_name }} | |
env: | |
GH_TOKEN: ${{ github.token }} |