Files
sensevoice/.github/workflows/sensevoice-container.yml
T

79 lines
1.9 KiB
YAML

name: SenseVoice container
on:
pull_request:
paths:
- Dockerfile
- requirements.txt
- api.py
- model.py
- .github/workflows/sensevoice-container.yml
- tests/test_container_contract.py
push:
branches:
- main
tags:
- "v*"
paths:
- Dockerfile
- requirements.txt
- api.py
- model.py
- .github/workflows/sensevoice-container.yml
- tests/test_container_contract.py
workflow_dispatch:
permissions:
contents: read
packages: write
concurrency:
group: sensevoice-container-${{ github.ref }}
cancel-in-progress: true
jobs:
contract:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate container contract
run: python -m unittest tests.test_container_contract
build:
needs: contract
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/sensevoice
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=sha
- name: Build and publish
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: true
sbom: true