| name: test-release |
|
|
| on: |
| workflow_call: |
| inputs: |
| working-directory: |
| required: true |
| type: string |
| description: "From which folder this pipeline executes" |
| dangerous-nonmaster-release: |
| required: false |
| type: boolean |
| default: false |
| description: "Release from a non-master branch (danger!)" |
|
|
| env: |
| PYTHON_VERSION: "3.11" |
| UV_FROZEN: "true" |
|
|
| jobs: |
| build: |
| if: github.ref == 'refs/heads/master' || inputs.dangerous-nonmaster-release |
| runs-on: ubuntu-latest |
|
|
| outputs: |
| pkg-name: ${{ steps.check-version.outputs.pkg-name }} |
| version: ${{ steps.check-version.outputs.version }} |
|
|
| steps: |
| - uses: actions/checkout@v4 |
|
|
| - name: Set up Python + uv |
| uses: "./.github/actions/uv_setup" |
| with: |
| python-version: ${{ env.PYTHON_VERSION }} |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| - name: Build project for distribution |
| run: uv build |
| working-directory: ${{ inputs.working-directory }} |
|
|
| - name: Upload build |
| uses: actions/upload-artifact@v4 |
| with: |
| name: test-dist |
| path: ${{ inputs.working-directory }}/dist/ |
|
|
| - name: Check Version |
| id: check-version |
| shell: python |
| working-directory: ${{ inputs.working-directory }} |
| run: | |
| import os |
| import tomllib |
| with open("pyproject.toml", "rb") as f: |
| data = tomllib.load(f) |
| pkg_name = data["project"]["name"] |
| version = data["project"]["version"] |
| with open(os.environ["GITHUB_OUTPUT"], "a") as f: |
| f.write(f"pkg-name={pkg_name}\n") |
| f.write(f"version={version}\n") |
| |
| publish: |
| needs: |
| - build |
| runs-on: ubuntu-latest |
| permissions: |
| |
| |
| |
| |
| |
| id-token: write |
|
|
| steps: |
| - uses: actions/checkout@v4 |
|
|
| - uses: actions/download-artifact@v4 |
| with: |
| name: test-dist |
| path: ${{ inputs.working-directory }}/dist/ |
|
|
| - name: Publish to test PyPI |
| uses: pypa/gh-action-pypi-publish@release/v1 |
| with: |
| packages-dir: ${{ inputs.working-directory }}/dist/ |
| verbose: true |
| print-hash: true |
| repository-url: https://test.pypi.org/legacy/ |
|
|
| |
| |
| |
| skip-existing: true |
| |
| attestations: false |
|
|