# This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by # separate terms of service, privacy policy, and support # documentation. name: Release on: push: branches: - main permissions: # added using https://github.com/step-security/secure-workflows contents: read jobs: release-please: permissions: contents: write # for google-github-actions/release-please-action to create release commit pull-requests: write # for google-github-actions/release-please-action to create release PR runs-on: ubuntu-latest steps: - uses: google-github-actions/release-please-action@v3 id: release with: command: manifest token: ${{secrets.GITHUB_TOKEN}} default-branch: main outputs: release_created: ${{ steps.release.outputs.release_created }} release_tag_name: ${{ steps.release.outputs.tag_name }} release: runs-on: ubuntu-latest needs: release-please if: ${{ needs.release-please.outputs.release_created }} container: image: "python:3.11" steps: - uses: actions/checkout@v3 - name: Cache virtualenvironment uses: actions/cache@v3 with: path: ~/.venv key: ${{ hashFiles('requirements.txt', 'requirements-dev.txt') }} - name: Upgrade pip run: pip install --upgrade pip - name: Create and activate Virtualenv run: | pip install virtualenv [ ! -d ".venv" ] && virtualenv .venv . .venv/bin/activate - name: Install dependencies run: pip install -r requirements.txt - name: Install pypa/build run: >- python -m pip install build --user - name: Build a binary wheel and a source tarball run: >- python -m build --sdist --wheel --outdir dist/ . - name: Publish a Python distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }}