diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index 18404be59..4c1312be5 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -131,3 +131,25 @@ jobs: - linux uses: ./.github/workflows/dotnet-maui.yml secrets: inherit + + upload-build-artifacts: + needs: + - android + - macos + - windows + - wasm + - linux + - windows-vulkan + - linux-vulkan + - windows-openvino + - linux-openvino + - windows-no-avx + - linux-no-avx + if: > + (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && + (github.ref == 'refs/heads/main') + permissions: + contents: write + uses: ./.github/workflows/upload-build-artifacts.yml + secrets: inherit + diff --git a/.github/workflows/upload-build-artifacts.yml b/.github/workflows/upload-build-artifacts.yml new file mode 100644 index 000000000..1b2872978 --- /dev/null +++ b/.github/workflows/upload-build-artifacts.yml @@ -0,0 +1,54 @@ +name: Upload Build Artifacts + +permissions: + contents: write + +on: + workflow_call: + +jobs: + upload-artifacts: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Check for existing release with same commit + id: check-release + run: | + COMMIT=${{ steps.release-info.outputs.commit }} + if gh release list --limit 100 --json tagName --jq ".[] | select(.tagName | contains(\"${COMMIT}\"))"; then + echo "release_exists=true" >> "$GITHUB_OUTPUT" + else + echo "release_exists=false" >> "$GITHUB_OUTPUT" + fi + env: + GH_TOKEN: ${{ github.token }} + + - name: Download Artifacts + if: steps.check-release.outputs.release_exists != 'true' + id: download-artifact + uses: actions/download-artifact@v4 + with: + merge-multiple: true + path: runtime-artifacts + + - name: Zip Artifacts + if: steps.check-release.outputs.release_exists != 'true' + run: | + zip -r native-runtimes.zip runtime-artifacts + + - name: Set release info + id: release-info + run: | + echo "date=$(date -u +'%Y%m%d-%H%M')" >> "$GITHUB_OUTPUT" + echo "commit=$(git -C whisper.cpp rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + + - name: Create preview release + if: steps.check-release.outputs.release_exists != 'true' + uses: ncipollo/release-action@90dc22b77f7e5e8d3a3a92924b18415dca53f445 + with: + tag: preview-${{ steps.release-info.outputs.date }}-${{ steps.release-info.outputs.commit }} + name: Preview ${{ steps.release-info.outputs.date }} (${{ steps.release-info.outputs.commit }}) + artifacts: native-runtimes.zip + prerelease: true +