Publish to TestPyPI #3
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
| # This workflow uploads OmegaConf to TestPyPI for testing | |
| # Trigger manually or on pre-release to test the publishing workflow | |
| name: Publish to TestPyPI | |
| on: | |
| release: | |
| types: [prereleased] | |
| workflow_dispatch: # Allows manual triggering from GitHub Actions tab | |
| jobs: | |
| build-artifacts: | |
| name: Build distribution artifacts | |
| runs-on: ubuntu-latest | |
| environment: testpypi-publish | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| - name: Set up Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '11' | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build | |
| - name: Build distribution | |
| run: python -m build | |
| - name: Verify build artifacts | |
| run: | | |
| ls -lah dist/ | |
| python -m pip install twine | |
| twine check dist/* | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| retention-days: 0 | |
| testpypi-publish: | |
| needs: build-artifacts | |
| name: Upload release to TestPyPI | |
| runs-on: ubuntu-latest | |
| environment: testpypi-publish | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish package distributions to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ |