Free up space #4
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-vosk-ghcr | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
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.11.0 | ||
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: | ||
matrix: | ||
value: ${{fromJSON(needs.setup.outputs.matrix)}} | ||
steps: | ||
- | ||
name: Checkout | ||
id: repo-checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Set up QEMU | ||
id: setup-qemu | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Log in to registry | ||
id: registry-login | ||
uses: redhat-actions/podman-login@v1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
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 | ||
run: echo "url=$(echo ${{ matrix.value }} | cut -d'~' -f2)" >> $GITHUB_OUTPUT | ||
id: remove_useless_stuff | ||
run: | | ||
Check failure on line 86 in .github/workflows/monkeyplug-build-push-vosk-ghcr.yml GitHub Actions / monkeyplug-build-push-vosk-ghcrInvalid workflow file
|
||
sudo rm -rf /usr/share/dotnet \ | ||
/usr/local/lib/android \ | ||
/opt/ghc \ | ||
/usr/local/share/boost \ | ||
"$AGENT_TOOLSDIRECTORY" || true | ||
- | ||
name: Build (VOSK) | ||
id: build-vosk-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: ${{ env.IMAGE_NAME }} | ||
tags: vosk-${{ steps.extract_tag.outputs.tag }} | ||
context: ${{ env.REPO_CONTEXT }} | ||
containerfiles: ${{ env.REPO_CONTAINERFILE }} | ||
archs: ${{ env.IMAGE_ARCH }} | ||
target: vosk | ||
build-args: | | ||
VOSK_MODEL_URL=${{ steps.extract_url.outputs.url }} | ||
- | ||
name: Run Trivy vulnerability scanner (VOSK) | ||
id: trivy-scan | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
scan-type: 'image' | ||
image-ref: ${{ steps.build-vosk-image.outputs.image }}:${{ steps.build-vosk-image.outputs.tags }} | ||
format: 'sarif' | ||
output: 'trivy-results.sarif' | ||
severity: 'HIGH,CRITICAL' | ||
vuln-type: 'os,library' | ||
hide-progress: true | ||
ignore-unfixed: true | ||
exit-code: '0' | ||
- | ||
name: Upload Trivy scan results to GitHub Security tab (VOSK) | ||
uses: github/codeql-action/upload-sarif@v2 | ||
if: always() | ||
with: | ||
sarif_file: 'trivy-results.sarif' | ||
- | ||
name: Push (VOSK) | ||
id: push-vosk-image | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: ${{ steps.build-vosk-image.outputs.image }} | ||
tags: ${{ steps.build-vosk-image.outputs.tags }} | ||
registry: ${{ env.REGISTRY }} |