name: Python wheel # Dry-run on every pull request and on main. This workflow does not publish # to public PyPI. TestPyPI runs only from a manual dispatch, and only when # the confirm phrase, the Gary yes variable, and the TestPyPI token are all set. on: pull_request: push: branches: [main] workflow_dispatch: inputs: publish_target: description: "Upload target. Public PyPI is refused. none stays a dry run." type: choice default: none options: - none - testpypi confirm: description: "Type publish-testpypi to arm TestPyPI. Any other value stays a dry run." type: string default: "" permissions: contents: read concurrency: group: aureon-python-wheel-${{ github.ref }} cancel-in-progress: true jobs: dry-run: name: build wheel (no upload) runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 with: fetch-depth: 1 persist-credentials: false - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 with: python-version: "3.12" - name: Install build tools run: >- python -m pip install --disable-pip-version-check --no-input build==1.6.1 twine==7.0.0 pytest==9.0.2 PyYAML==6.0.3 - name: Wheel contract run: pytest tests/test_wheel_packaging.py -o addopts= -q - name: Dry-run wheel build run: python packaging/build_wheel.py - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: aureon-wheel-dry-run path: dist/python-wheel/* if-no-files-found: error retention-days: 7 publish-testpypi: name: TestPyPI upload (gated) needs: dry-run if: >- github.event_name == 'workflow_dispatch' && github.event.inputs.publish_target == 'testpypi' && github.event.inputs.confirm == 'publish-testpypi' && vars.AUREON_ALLOW_TESTPYPI == 'gary-yes' environment: testpypi runs-on: ubuntu-latest timeout-minutes: 15 permissions: contents: read steps: - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 with: fetch-depth: 1 persist-credentials: false - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 with: python-version: "3.12" - name: Install twine run: >- python -m pip install --disable-pip-version-check --no-input twine==7.0.0 - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 with: name: aureon-wheel-dry-run path: dist/python-wheel - name: Upload to TestPyPI or refuse env: AUREON_PUBLISH_CONFIRM: ${{ github.event.inputs.confirm }} AUREON_ALLOW_TESTPYPI: ${{ vars.AUREON_ALLOW_TESTPYPI }} TWINE_PASSWORD: ${{ secrets.TESTPYPI_API_TOKEN }} run: python packaging/upload_testpypi.py