Merge pull request #145 from MScottBlake/fix-pypi-publish #51
Workflow file for this run
This file contains hidden or 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: Publish to PyPI | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read # For checkout | |
| id-token: write # For PEP 740 attestations | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0 | |
| - name: Build | |
| run: uv build | |
| - name: Attestation | |
| uses: astral-sh/attest-action@2c727738cea36d6c97dd85eb133ea0e0e8fe754b # v0.0.4 | |
| - name: Upload Package Artifacts | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| path: dist/ | |
| publish-to-testpypi: | |
| name: Publish to TestPyPI | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| environment: | |
| name: TestPyPi | |
| url: https://test.pypi.org/p/cloud-autopkg-runner | |
| permissions: | |
| id-token: write # For PyPI's trusted publishing | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0 | |
| with: | |
| ignore-empty-workdir: true | |
| - name: Download Package Artifacts | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| path: dist/ | |
| - name: Publish | |
| run: uv publish --index testpypi --trusted-publishing always | |
| install-library-from-testpypi: | |
| name: Test Installation from TestPyPI | |
| needs: [publish-to-testpypi] | |
| runs-on: ubuntu-latest | |
| permissions: {} # No token access needed | |
| steps: | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0 | |
| with: | |
| ignore-empty-workdir: true | |
| - name: Install | |
| run: uv run --with cloud-autopkg-runner --extra-index-url https://test.pypi.org/simple/ --index-strategy unsafe-best-match --no-project -- python -c "import cloud_autopkg_runner" | |
| publish-to-pypi: | |
| name: Publish to PyPI | |
| needs: [install-library-from-testpypi] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: PyPi | |
| url: https://pypi.org/p/cloud-autopkg-runner | |
| permissions: | |
| id-token: write # For PyPI's trusted publishing | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0 | |
| with: | |
| ignore-empty-workdir: true | |
| - name: Download Package Artifacts | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| path: dist/ | |
| - name: Publish | |
| run: uv publish --trusted-publishing always | |
| install-library-from-pypi: | |
| name: Test Installation from PyPI | |
| needs: [publish-to-pypi] | |
| runs-on: ubuntu-latest | |
| permissions: {} # No token access needed | |
| steps: | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0 | |
| with: | |
| ignore-empty-workdir: true | |
| - name: Install | |
| run: uv run --with cloud-autopkg-runner --no-project -- python -c "import cloud_autopkg_runner" |