🧷 Set version to 0.6.0 #33
This file contains 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
on: | |
push: | |
branches: [main] | |
pull_request: | |
release: | |
types: [ published ] | |
jobs: | |
test: | |
name: Unit tests / ${{ matrix.python }} / ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest ] | |
python: [ "3.11", "3.12" ] | |
fail-fast: true | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
id: setup-uv | |
uses: astral-sh/setup-uv@v2 | |
with: | |
version: "0.4.10" | |
enable-cache: true | |
- name: Install Python | |
id: setup-python | |
run: uv python install ${{ matrix.python }} | |
# Sync dependencies without dev dependencies | |
- name: Sync dependencies | |
run: uv sync --frozen --no-dev | |
# Install the project | |
- name: Install library | |
run: uv pip install --no-deps . | |
- name: Artifact creation | |
run: uv build | |
- name: Save artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ matrix.os }}-${{ matrix.python }}" | |
path: ./dist | |
upload_pypi: | |
name: Release to PyPi | |
needs: [test] | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
# upload to PyPI only on release | |
if: github.event.release && github.event.action == 'published' | |
steps: | |
- name: Retrieve release distributions | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
merge-multiple: true | |
- name: Publish release distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
build_and_push_docker: | |
name: Build and Push Docker Image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
id-token: write # needed for signing the images with GitHub OIDC Token | |
env: | |
IMAGE_NAME: qabot | |
IMAGE_REGISTRY: ghcr.io | |
IMAGE_REPOSITORY: hardbyte | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{env.IMAGE_REGISTRY}}/${{env.IMAGE_REPOSITORY}}/${{env.IMAGE_NAME}} | |
tags: | | |
type=sha | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.IMAGE_REGISTRY }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |