[main]: added publish workflow #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: Publish to TestPyPI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| REPO_ALIAS: rz-sample | |
| TEST_PYPI_URL: https://test.pypi.org/legacy/ | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Poetry | |
| run: | | |
| curl -sSL https://install.python-poetry.org | python3 - | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Configure Poetry for TestPyPI | |
| run: | | |
| # Use the variables defined in the 'env' section | |
| poetry config repositories.${{ env.REPO_ALIAS }} ${{ env.TEST_PYPI_URL }} | |
| poetry config pypi-token.${{ env.REPO_ALIAS }} ${{ secrets.TEST_PYPI_TOKEN }} | |
| - name: Build and Publish | |
| run: | | |
| # Automatically uses the alias for the -r flag | |
| poetry publish -r ${{ env.REPO_ALIAS }} --build |