Merge pull request #2 from vintasoftware/bump-vintasend-to-1.0.1 #2
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 Package | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Triggers on tags like v1.0.0, v2.1.3, etc. | |
| jobs: | |
| test-before-publish: | |
| name: Run tests before publishing | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install poetry | |
| poetry install | |
| - name: Run tests | |
| run: poetry run tox | |
| env: | |
| OPENAI_API_KEY: "sk-fake-test-key-123" | |
| # Make sure tests pass before publishing | |
| check-tests: | |
| name: Check that tests pass | |
| runs-on: ubuntu-latest | |
| needs: test-before-publish | |
| steps: | |
| - name: Tests passed | |
| run: echo "All tests passed successfully" | |
| # Publish only after tests pass | |
| publish-release: | |
| name: Publish release | |
| needs: [test-before-publish, check-tests] | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.test-before-publish.result == 'success' }} | |
| permissions: | |
| contents: write # Needed to create GitHub releases | |
| id-token: write # Needed for trusted publishing to PyPI | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch full history for proper version detection | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" # Use a stable Python version for publishing | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: latest | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Cache Poetry dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Install dependencies | |
| run: poetry install --only=main | |
| - name: Build package | |
| run: poetry build | |
| - name: Verify package contents | |
| run: | | |
| # List the built packages | |
| ls -la dist/ | |
| # Check package contents | |
| poetry run pip install twine | |
| poetry run twine check dist/* | |
| - name: Publish to PyPI | |
| env: | |
| POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} | |
| run: | | |
| poetry config pypi-token.pypi $POETRY_PYPI_TOKEN_PYPI | |
| poetry publish |