Skip to content

Commit b38ba41

Browse files
committed
Add Vulkan release bundles
1 parent 85b76ec commit b38ba41

1 file changed

Lines changed: 117 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 117 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ on:
2323
options:
2424
- portable
2525
- cuda
26+
- vulkan
2627

2728
permissions:
2829
contents: write
@@ -59,7 +60,7 @@ jobs:
5960
--generate-notes
6061
6162
build-portable:
62-
if: github.event_name == 'push' || inputs.bundle_variant != 'cuda'
63+
if: github.event_name == 'push' || inputs.bundle_variant == 'portable'
6364
needs: ensure-release
6465
runs-on: ubuntu-latest
6566
steps:
@@ -280,12 +281,98 @@ jobs:
280281
dist/${{ steps.meta.outputs.bundle }}.tar.gz
281282
dist/${{ steps.meta.outputs.bundle }}.tar.gz.sha256
282283
284+
build-vulkan:
285+
if: github.event_name == 'push' || inputs.bundle_variant == 'vulkan'
286+
needs: ensure-release
287+
runs-on: ubuntu-latest
288+
steps:
289+
- name: Checkout current ref
290+
if: github.event_name != 'workflow_dispatch' || inputs.publish_release != true
291+
uses: actions/checkout@v5
292+
293+
- name: Checkout requested release tag
294+
if: github.event_name == 'workflow_dispatch' && inputs.publish_release == true
295+
uses: actions/checkout@v5
296+
with:
297+
ref: ${{ inputs.tag_name }}
298+
299+
- name: Install Rust toolchain
300+
uses: dtolnay/rust-toolchain@stable
301+
302+
- name: Install Linux build deps
303+
run: |
304+
sudo apt-get update
305+
sudo apt-get install -y build-essential cmake clang pkg-config libasound2-dev libvulkan-dev
306+
307+
- name: Cache cargo
308+
uses: Swatinem/rust-cache@v2
309+
310+
- name: Compute release metadata
311+
id: meta
312+
env:
313+
INPUT_PUBLISH_RELEASE: ${{ inputs.publish_release }}
314+
INPUT_TAG_NAME: ${{ inputs.tag_name }}
315+
run: |
316+
set -euo pipefail
317+
318+
version=$(awk -F '"' '$1 ~ /^version *=/ { print $2; exit }' Cargo.toml)
319+
bundle="whispers-vulkan-${version}-x86_64-unknown-linux-gnu"
320+
publish=false
321+
tag_name=""
322+
323+
if [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then
324+
publish=true
325+
tag_name="${GITHUB_REF_NAME}"
326+
elif [[ "${INPUT_PUBLISH_RELEASE:-false}" == "true" ]]; then
327+
publish=true
328+
tag_name="${INPUT_TAG_NAME}"
329+
fi
330+
331+
if [[ "$publish" == "true" ]]; then
332+
if [[ -z "$tag_name" ]]; then
333+
echo "::error::tag_name is required when publish_release=true"
334+
exit 1
335+
fi
336+
if [[ "$tag_name" != "v$version" ]]; then
337+
echo "::error::tag ${tag_name} does not match Cargo.toml version v${version}"
338+
exit 1
339+
fi
340+
checked_out_commit=$(git rev-parse HEAD)
341+
tag_commit=$(git rev-list -n1 "$tag_name")
342+
if [[ "$checked_out_commit" != "$tag_commit" ]]; then
343+
echo "::error::checked out ${checked_out_commit} but tag ${tag_name} points to ${tag_commit}"
344+
exit 1
345+
fi
346+
fi
347+
348+
{
349+
echo "bundle=$bundle"
350+
echo "publish=$publish"
351+
echo "tag_name=$tag_name"
352+
echo "version=$version"
353+
} >> "$GITHUB_OUTPUT"
354+
355+
- name: Build Vulkan release bundle
356+
env:
357+
WHISPERS_RELEASE_BUNDLE_PREFIX: whispers-vulkan
358+
WHISPERS_RELEASE_FEATURES: vulkan,local-rewrite,osd
359+
run: scripts/build-release-bundle.sh "${{ steps.meta.outputs.version }}"
360+
361+
- name: Upload Vulkan release bundle artifact
362+
uses: actions/upload-artifact@v4
363+
with:
364+
name: vulkan-release-bundle
365+
path: |
366+
dist/${{ steps.meta.outputs.bundle }}.tar.gz
367+
dist/${{ steps.meta.outputs.bundle }}.tar.gz.sha256
368+
283369
publish-release-push:
284370
if: github.event_name == 'push'
285371
needs:
286372
- ensure-release
287373
- build-portable
288374
- build-cuda
375+
- build-vulkan
289376
runs-on: ubuntu-latest
290377
steps:
291378
- name: Download portable artifact
@@ -300,6 +387,12 @@ jobs:
300387
name: cuda-release-bundle
301388
path: dist
302389

390+
- name: Download Vulkan artifact
391+
uses: actions/download-artifact@v4
392+
with:
393+
name: vulkan-release-bundle
394+
path: dist
395+
303396
- name: Publish release assets
304397
env:
305398
GH_TOKEN: ${{ github.token }}
@@ -310,7 +403,7 @@ jobs:
310403
gh release upload "$TAG_NAME" dist/* --clobber
311404
312405
publish-release-portable-dispatch:
313-
if: github.event_name == 'workflow_dispatch' && inputs.publish_release == true && inputs.bundle_variant != 'cuda'
406+
if: github.event_name == 'workflow_dispatch' && inputs.publish_release == true && inputs.bundle_variant == 'portable'
314407
needs:
315408
- ensure-release
316409
- build-portable
@@ -352,3 +445,25 @@ jobs:
352445
run: |
353446
set -euo pipefail
354447
gh release upload "$TAG_NAME" dist/* --clobber
448+
449+
publish-release-vulkan-dispatch:
450+
if: github.event_name == 'workflow_dispatch' && inputs.publish_release == true && inputs.bundle_variant == 'vulkan'
451+
needs:
452+
- ensure-release
453+
- build-vulkan
454+
runs-on: ubuntu-latest
455+
steps:
456+
- name: Download Vulkan artifact
457+
uses: actions/download-artifact@v4
458+
with:
459+
name: vulkan-release-bundle
460+
path: dist
461+
462+
- name: Publish Vulkan release assets
463+
env:
464+
GH_TOKEN: ${{ github.token }}
465+
GH_REPO: ${{ github.repository }}
466+
TAG_NAME: ${{ inputs.tag_name }}
467+
run: |
468+
set -euo pipefail
469+
gh release upload "$TAG_NAME" dist/* --clobber

0 commit comments

Comments
 (0)