name: Release package on: workflow_dispatch: inputs: release-type: type: choice description: 'Release type (one of): patch, minor, major' default: 'patch' options: - 'patch' - 'minor' - 'major' required: true permissions: contents: write packages: write jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Install the latest version of uv uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 - name: Install dependencies run: uv sync - name: Run Python tests run: uv run pytest --cov - name: Git configuration run: | git config --global user.email "bot@example.com" git config --global user.name "GitHub Actions" - name: Bump release version run: | uv version --bump ${{ github.event.inputs.release-type }} echo "NEW_VERSION=$(uv version --short)" >> $GITHUB_ENV - name: Update lock file and build package run: | uv lock uv build - name: Commit pyproject.toml and uv.lock run: | git add pyproject.toml uv.lock git commit -m "chore: release ${{ env.NEW_VERSION }}" git tag ${{ env.NEW_VERSION }} git push origin master --follow-tags - name: Publish package to PyPI run: uv publish env: UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} - name: Log in to the Container registry uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Build and push Docker image uses: docker/build-push-action@v7 with: context: . push: true platforms: linux/amd64 tags: | ghcr.io/${{ github.repository }}:${{ env.NEW_VERSION }} ghcr.io/${{ github.repository }}:latest