Skip to content

Update release.yml

Update release.yml #21

Workflow file for this run

name: Release
on:
push:
branches: ["dev"]
paths:
- "src/**"
- "tests/**"
- "pyproject.toml"
- "Dockerfile"
- "uv.lock"
- ".github/**"
jobs:
check:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.5.13"
- name: Set up Python
run: uv python install
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Run ruff
run: uv run ruff check .
- name: Run mypy
run: uv run mypy .
test:
runs-on: ubuntu-24.04
timeout-minutes: 15
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.5.13"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Run tests
run: uv run pytest .
release:
runs-on: ubuntu-24.04
needs:
- check
- test
concurrency: release
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Python Semantic Release
id: release
uses: python-semantic-release/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
docker:
runs-on: ubuntu-24.04
needs: release
if: needs.release.outputs.released == 'true'
steps:
- uses: actions/checkout@v4
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and scan image
uses: docker/build-push-action@v6
with:
push: false
load: true
tags: antonk0/gigachat-adapter:${{ needs.release.outputs.version }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: antonk0/gigachat-adapter:${{ needs.release.outputs.version }}
format: "table"
exit-code: "1"
severity: "CRITICAL"
# - name: Build and Push Docker image
# uses: docker/build-push-action@v6
# with:
# push: true
# tags: |
# antonk0/gigachat-adapter:latest
# antonk0/gigachat-adapter:${{ needs.release.outputs.version }}