From 707a00e491738b4e742cbb015a6413bae7cbfccd Mon Sep 17 00:00:00 2001 From: Sandro Hanea <40202887+sandrohanea@users.noreply.github.com> Date: Thu, 12 Jun 2025 16:41:33 +0200 Subject: [PATCH 1/8] chore: add preview artifact release workflow --- .github/workflows/build-all.yml | 17 ++++++++++ .github/workflows/upload-build-artifacts.yml | 34 ++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .github/workflows/upload-build-artifacts.yml diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index 18404be59..61a38d4cc 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -131,3 +131,20 @@ 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 + 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..4258f5092 --- /dev/null +++ b/.github/workflows/upload-build-artifacts.yml @@ -0,0 +1,34 @@ +name: Upload Build Artifacts + +permissions: + contents: write + +on: + workflow_call: + +jobs: + upload-artifacts: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Download Artifacts + id: download-artifact + uses: actions/download-artifact@v4 + with: + merge-multiple: true + path: 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 + uses: ncipollo/release-action@v1 + 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: runtime-artifacts/** + prerelease: true From ea806088c0dc042248e31892211332ca26c4e6d2 Mon Sep 17 00:00:00 2001 From: Sandro Hanea <40202887+sandrohanea@users.noreply.github.com> Date: Thu, 12 Jun 2025 16:56:14 +0200 Subject: [PATCH 2/8] Pin release action by commit --- .github/workflows/upload-build-artifacts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/upload-build-artifacts.yml b/.github/workflows/upload-build-artifacts.yml index 4258f5092..b83f7e2c4 100644 --- a/.github/workflows/upload-build-artifacts.yml +++ b/.github/workflows/upload-build-artifacts.yml @@ -26,7 +26,7 @@ jobs: echo "commit=$(git -C whisper.cpp rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" - name: Create preview release - uses: ncipollo/release-action@v1 + 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 }}) From a0e94efac5849f0335073ee872293f860884b8bf Mon Sep 17 00:00:00 2001 From: Sandro Hanea <40202887+sandrohanea@users.noreply.github.com> Date: Thu, 12 Jun 2025 16:57:19 +0200 Subject: [PATCH 3/8] Update build-all.yml --- .github/workflows/build-all.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index 61a38d4cc..29b6f3386 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -145,6 +145,10 @@ jobs: - linux-openvino - windows-no-avx - linux-no-avx + + if: github.ref == 'refs/heads/main' + permissions: + contents: write uses: ./.github/workflows/upload-build-artifacts.yml secrets: inherit From 0ad75e00485922215e235c7635a560202fbfc022 Mon Sep 17 00:00:00 2001 From: Sandro Hanea <40202887+sandrohanea@users.noreply.github.com> Date: Thu, 12 Jun 2025 17:01:31 +0200 Subject: [PATCH 4/8] Update build-all.yml --- .github/workflows/build-all.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index 29b6f3386..30c0d33aa 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -145,8 +145,9 @@ jobs: - linux-openvino - windows-no-avx - linux-no-avx - - if: github.ref == 'refs/heads/main' + if: > + (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && + (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/codex/enhance-ci-workflow-to-upload-artifacts-to-preview-release') permissions: contents: write uses: ./.github/workflows/upload-build-artifacts.yml From ab87c04da46ca656de67cd0961ea3158e8714010 Mon Sep 17 00:00:00 2001 From: Sandro Hanea <40202887+sandrohanea@users.noreply.github.com> Date: Thu, 12 Jun 2025 17:25:41 +0200 Subject: [PATCH 5/8] Update upload-build-artifacts.yml --- .github/workflows/upload-build-artifacts.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/upload-build-artifacts.yml b/.github/workflows/upload-build-artifacts.yml index b83f7e2c4..822e67389 100644 --- a/.github/workflows/upload-build-artifacts.yml +++ b/.github/workflows/upload-build-artifacts.yml @@ -19,6 +19,10 @@ jobs: merge-multiple: true path: runtime-artifacts + - name: Zip Artifacts + run: | + zip -r native-runtimes.zip runtime-artifacts + - name: Set release info id: release-info run: | @@ -30,5 +34,5 @@ jobs: 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: runtime-artifacts/** + artifacts: native-runtimes.zip prerelease: true From 912cae8d063badfe04f44445d24e802fe19bcfed Mon Sep 17 00:00:00 2001 From: Sandro Hanea <40202887+sandrohanea@users.noreply.github.com> Date: Thu, 12 Jun 2025 17:31:17 +0200 Subject: [PATCH 6/8] Update upload-build-artifacts.yml --- .github/workflows/upload-build-artifacts.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/upload-build-artifacts.yml b/.github/workflows/upload-build-artifacts.yml index 822e67389..ee0658055 100644 --- a/.github/workflows/upload-build-artifacts.yml +++ b/.github/workflows/upload-build-artifacts.yml @@ -21,18 +21,32 @@ jobs: - name: Zip Artifacts run: | - zip -r native-runtimes.zip runtime-artifacts - + 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: 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: 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 + From 51fc37c7255b6da0c2a2deceae7a144be84eda36 Mon Sep 17 00:00:00 2001 From: Sandro Hanea <40202887+sandrohanea@users.noreply.github.com> Date: Thu, 12 Jun 2025 17:41:35 +0200 Subject: [PATCH 7/8] Update upload-build-artifacts.yml --- .github/workflows/upload-build-artifacts.yml | 26 +++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/upload-build-artifacts.yml b/.github/workflows/upload-build-artifacts.yml index ee0658055..1b2872978 100644 --- a/.github/workflows/upload-build-artifacts.yml +++ b/.github/workflows/upload-build-artifacts.yml @@ -12,7 +12,20 @@ jobs: 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: @@ -20,6 +33,7 @@ jobs: path: runtime-artifacts - name: Zip Artifacts + if: steps.check-release.outputs.release_exists != 'true' run: | zip -r native-runtimes.zip runtime-artifacts @@ -29,18 +43,6 @@ jobs: echo "date=$(date -u +'%Y%m%d-%H%M')" >> "$GITHUB_OUTPUT" echo "commit=$(git -C whisper.cpp rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" - - 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: Create preview release if: steps.check-release.outputs.release_exists != 'true' uses: ncipollo/release-action@90dc22b77f7e5e8d3a3a92924b18415dca53f445 From 9f335784e242f8a871c22f1946a0b6cb1003ded1 Mon Sep 17 00:00:00 2001 From: Sandro Hanea <40202887+sandrohanea@users.noreply.github.com> Date: Thu, 12 Jun 2025 17:42:00 +0200 Subject: [PATCH 8/8] Update build-all.yml --- .github/workflows/build-all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index 30c0d33aa..4c1312be5 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -147,7 +147,7 @@ jobs: - linux-no-avx if: > (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && - (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/codex/enhance-ci-workflow-to-upload-artifacts-to-preview-release') + (github.ref == 'refs/heads/main') permissions: contents: write uses: ./.github/workflows/upload-build-artifacts.yml