Test Upload Python Package #1
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: Test Upload Python Package | |
| on: | |
| workflow_dispatch: | |
| workflow: "*" | |
| jobs: | |
| Build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.x" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install setuptools wheel twine | |
| - name: Build | |
| run: | | |
| python setup.py sdist bdist_wheel | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| path: dist/* | |
| name: artifacts | |
| Publish: | |
| needs: [Build] | |
| name: Publish to TestPyPI | |
| # Only run when dispatched manually | |
| runs-on: Ubuntu-latest | |
| permissions: | |
| # IMPORTANT: this permission is mandatory for trusted publishing | |
| id-token: write | |
| steps: | |
| - name: Download dist | |
| uses: actions/[email protected] | |
| with: | |
| name: artifacts | |
| path: dist | |
| - name: Display downloaded files | |
| run: | | |
| ls -shR | |
| working-directory: dist | |
| - name: Publish to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ |