-
Notifications
You must be signed in to change notification settings - Fork 1
135 lines (132 loc) · 3.95 KB
/
monkeyplug-build-push-vosk-ghcr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
---
name: monkeyplug-build-push-vosk-ghcr
on:
push:
branches:
- 'main'
paths:
- '**'
- '!.github/workflows/monkeyplug-build-push-whisper-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 VOSK URLs
id: matrix
run: |
echo "value=[\"small~https://alphacephei.com/kaldi/models/vosk-model-small-en-us-0.15.zip\", \"large~http://alphacephei.com/vosk/models/vosk-model-en-us-0.22.zip\"]" >> $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: Extract tag name
shell: bash
run: echo "tag=$(echo ${{ matrix.value }} | cut -d'~' -f1)" >> $GITHUB_OUTPUT
id: extract_tag
-
name: Extract model URL
shell: bash
run: echo "url=$(echo ${{ matrix.value }} | cut -d'~' -f2)" >> $GITHUB_OUTPUT
id: extract_url
-
name: Free up space
shell: bash
id: remove_useless_stuff
run: |
sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true
sudo rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/ghc \
/usr/lib/jvm \
/usr/local/.ghcup \
/usr/local/lib/android \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift >/dev/null 2>&1 || true
sudo env DEBIAN_FRONTEND=noninteractive apt-get -q -y update >/dev/null 2>&1
sudo env DEBIAN_FRONTEND=noninteractive apt-get -q -y --purge remove \
azure-cli \
dotnet* \
firefox \
google-chrome-stable \
google-cloud-cli \
microsoft-edge-stable \
mono-* \
mysql* \
postgresql* \
powershell \
temurin* >/dev/null 2>&1 || true
sudo env DEBIAN_FRONTEND=noninteractive apt-get -q -y --purge autoremove >/dev/null 2>&1 || 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 (VOSK) image
id: build-and-push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ env.IMAGE_NAME }}:vosk-${{ steps.extract_tag.outputs.tag }}
context: ${{ env.REPO_CONTEXT }}
file: ${{ env.REPO_CONTAINERFILE }}
platforms: ${{ env.IMAGE_ARCH }}
target: vosk
build-args: |
VOSK_MODEL_URL=${{ steps.extract_url.outputs.url }}