monkeyplug-build-push-whisper-ghcr #25
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
--- | |
name: monkeyplug-build-push-whisper-ghcr | |
on: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- '**' | |
- '!.github/workflows/monkeyplug-build-push-vosk-ghcr.yml' | |
- '!.github/workflows/publish-to-pypi.yml' | |
- '!README.md' | |
pull_request: | |
workflow_dispatch: | |
repository_dispatch: | |
schedule: | |
- cron: '0 12 15 * *' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/monkeyplug | |
IMAGE_ARCH: amd64 | |
REPO_CONTEXT: . | |
REPO_CONTAINERFILE: ./docker/Dockerfile | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.matrix.outputs.value }} | |
steps: | |
- | |
name: Cancel previous run in progress | |
id: cancel-previous-runs | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
ignore_sha: true | |
all_but_latest: true | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Enumerate Whisper models | |
id: matrix | |
run: | | |
echo "value=[\"tiny.en\", \"tiny\", \"base.en\", \"base\", \"small.en\", \"small\", \"medium.en\", \"medium\", \"large-v1\", \"large-v2\", \"large-v3\", \"large\"]" >> $GITHUB_OUTPUT | |
- | |
run: | | |
echo "${{ steps.matrix.outputs.value }}" | |
buildah: | |
needs: [ setup ] | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
packages: write | |
contents: read | |
security-events: write | |
strategy: | |
fail-fast: false | |
matrix: | |
value: ${{fromJSON(needs.setup.outputs.matrix)}} | |
steps: | |
- | |
name: Checkout | |
id: repo-checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up QEMU | |
id: setup-qemu | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
id: setup-docker-buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: | | |
image=moby/buildkit:master | |
- | |
name: Free up space | |
shell: bash | |
id: remove_useless_stuff | |
run: | | |
sudo rm -rf /usr/share/dotnet \ | |
/usr/local/lib/android \ | |
/opt/ghc \ | |
/usr/local/share/boost \ | |
"$AGENT_TOOLSDIRECTORY" || true | |
- | |
name: ghcr.io login | |
id: ghcr-io-login | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Build and push Monkeyplug (Whisper) image | |
id: build-and-push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: ${{ env.IMAGE_NAME }}:whisper-${{ matrix.value }} | |
context: ${{ env.REPO_CONTEXT }} | |
file: ${{ env.REPO_CONTAINERFILE }} | |
platforms: ${{ env.IMAGE_ARCH }} | |
target: whisper | |
build-args: | | |
WHISPER_MODEL_NAME=${{ matrix.value }} |