Spaces:
Running
Running
ci : add release job and include xcframework (#2889)
Browse files* ci : add release job and include xcframework
This commit adds a release job that uploads the xcframework as an
artifact and creates a release with the xcframework as an asset.
This job can be triggered manually and enables a pre-release tag name to
be specified to that these releases can be distinguished from the
regular releases more easily.
Resolves: https://github.com/ggerganov/whisper.cpp/issues/2886
- .github/workflows/build.yml +181 -5
.github/workflows/build.yml
CHANGED
|
@@ -6,17 +6,80 @@ on:
|
|
| 6 |
- master
|
| 7 |
pull_request:
|
| 8 |
types: [opened, synchronize, reopened]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
concurrency:
|
| 11 |
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
|
| 12 |
cancel-in-progress: true
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
env:
|
| 15 |
ubuntu_image: "ubuntu:22.04"
|
| 16 |
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
| 17 |
|
| 18 |
jobs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
ubuntu-22:
|
|
|
|
|
|
|
| 20 |
runs-on: ubuntu-22.04
|
| 21 |
|
| 22 |
strategy:
|
|
@@ -43,6 +106,8 @@ jobs:
|
|
| 43 |
cmake --build build --config Release -j $(nproc)'
|
| 44 |
|
| 45 |
ubuntu-22-arm64:
|
|
|
|
|
|
|
| 46 |
runs-on: ubuntu-22.04
|
| 47 |
|
| 48 |
strategy:
|
|
@@ -69,6 +134,8 @@ jobs:
|
|
| 69 |
cmake --build build --config Release -j $(nproc)'
|
| 70 |
|
| 71 |
ubuntu-22-arm-v7:
|
|
|
|
|
|
|
| 72 |
runs-on: ubuntu-22.04
|
| 73 |
|
| 74 |
strategy:
|
|
@@ -95,6 +162,8 @@ jobs:
|
|
| 95 |
cmake --build build --config Release -j $(nproc)'
|
| 96 |
|
| 97 |
macOS-latest:
|
|
|
|
|
|
|
| 98 |
runs-on: macOS-latest
|
| 99 |
|
| 100 |
strategy:
|
|
@@ -129,11 +198,6 @@ jobs:
|
|
| 129 |
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
|
| 130 |
cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
|
| 131 |
|
| 132 |
-
- name: xcodebuild for swift package
|
| 133 |
-
id: xcodebuild
|
| 134 |
-
run: |
|
| 135 |
-
./build-xcframework.sh
|
| 136 |
-
|
| 137 |
|
| 138 |
# freeBSD-latest:
|
| 139 |
# runs-on: macos-12
|
|
@@ -154,6 +218,8 @@ jobs:
|
|
| 154 |
# cmake --build build --config Release
|
| 155 |
|
| 156 |
ubuntu-22-gcc:
|
|
|
|
|
|
|
| 157 |
runs-on: ubuntu-22.04
|
| 158 |
|
| 159 |
strategy:
|
|
@@ -182,6 +248,8 @@ jobs:
|
|
| 182 |
ctest -L gh --output-on-failure'
|
| 183 |
|
| 184 |
ubuntu-22-gcc-arm64:
|
|
|
|
|
|
|
| 185 |
runs-on: ubuntu-22.04
|
| 186 |
|
| 187 |
strategy:
|
|
@@ -210,6 +278,8 @@ jobs:
|
|
| 210 |
ctest -L gh --output-on-failure'
|
| 211 |
|
| 212 |
ubuntu-22-gcc-arm-v7:
|
|
|
|
|
|
|
| 213 |
runs-on: ubuntu-22.04
|
| 214 |
|
| 215 |
strategy:
|
|
@@ -238,6 +308,8 @@ jobs:
|
|
| 238 |
ctest -L gh --output-on-failure'
|
| 239 |
|
| 240 |
ubuntu-22-clang:
|
|
|
|
|
|
|
| 241 |
runs-on: ubuntu-22.04
|
| 242 |
|
| 243 |
strategy:
|
|
@@ -269,6 +341,8 @@ jobs:
|
|
| 269 |
ctest -L gh --output-on-failure'
|
| 270 |
|
| 271 |
ubuntu-22-gcc-sanitized:
|
|
|
|
|
|
|
| 272 |
runs-on: ubuntu-22.04
|
| 273 |
|
| 274 |
strategy:
|
|
@@ -297,6 +371,8 @@ jobs:
|
|
| 297 |
ctest -L gh --output-on-failure'
|
| 298 |
|
| 299 |
ubuntu-22-cmake-sycl:
|
|
|
|
|
|
|
| 300 |
runs-on: ubuntu-22.04
|
| 301 |
|
| 302 |
strategy:
|
|
@@ -347,6 +423,8 @@ jobs:
|
|
| 347 |
cmake --build . --config Release -j $(nproc)
|
| 348 |
|
| 349 |
ubuntu-22-cmake-sycl-fp16:
|
|
|
|
|
|
|
| 350 |
runs-on: ubuntu-22.04
|
| 351 |
|
| 352 |
strategy:
|
|
@@ -397,6 +475,8 @@ jobs:
|
|
| 397 |
cmake --build . --config Release -j $(nproc)
|
| 398 |
|
| 399 |
windows-msys2:
|
|
|
|
|
|
|
| 400 |
runs-on: windows-latest
|
| 401 |
|
| 402 |
strategy:
|
|
@@ -441,6 +521,8 @@ jobs:
|
|
| 441 |
cmake --build build --config ${{ matrix.build }} -j $(nproc)
|
| 442 |
|
| 443 |
windows:
|
|
|
|
|
|
|
| 444 |
runs-on: windows-latest
|
| 445 |
|
| 446 |
strategy:
|
|
@@ -501,6 +583,8 @@ jobs:
|
|
| 501 |
path: build/bin/${{ matrix.build }}
|
| 502 |
|
| 503 |
windows-blas:
|
|
|
|
|
|
|
| 504 |
runs-on: windows-latest
|
| 505 |
|
| 506 |
strategy:
|
|
@@ -574,6 +658,8 @@ jobs:
|
|
| 574 |
path: build/bin/${{ matrix.build }}
|
| 575 |
|
| 576 |
windows-cublas:
|
|
|
|
|
|
|
| 577 |
runs-on: windows-2019
|
| 578 |
strategy:
|
| 579 |
matrix:
|
|
@@ -642,6 +728,8 @@ jobs:
|
|
| 642 |
path: build/bin/${{ matrix.build }}
|
| 643 |
|
| 644 |
emscripten:
|
|
|
|
|
|
|
| 645 |
runs-on: ubuntu-22.04
|
| 646 |
|
| 647 |
strategy:
|
|
@@ -665,6 +753,7 @@ jobs:
|
|
| 665 |
|
| 666 |
ios-xcode-build:
|
| 667 |
runs-on: macos-latest
|
|
|
|
| 668 |
|
| 669 |
strategy:
|
| 670 |
matrix:
|
|
@@ -707,7 +796,26 @@ jobs:
|
|
| 707 |
- name: Build swiftui example
|
| 708 |
run: xcodebuild -project examples/whisper.swiftui/whisper.swiftui.xcodeproj -scheme WhisperCppDemo -configuration ${{ matrix.build }} -sdk iphoneos CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= -destination 'generic/platform=iOS' FRAMEWORK_FOLDER_PATH=./build-ios build
|
| 709 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 710 |
android:
|
|
|
|
|
|
|
| 711 |
runs-on: ubuntu-22.04
|
| 712 |
|
| 713 |
steps:
|
|
@@ -807,6 +915,8 @@ jobs:
|
|
| 807 |
# PGP_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
| 808 |
|
| 809 |
quantize:
|
|
|
|
|
|
|
| 810 |
runs-on: ubuntu-22.04
|
| 811 |
|
| 812 |
steps:
|
|
@@ -819,3 +929,69 @@ jobs:
|
|
| 819 |
cmake -B build
|
| 820 |
cmake --build build --config Release
|
| 821 |
./build/bin/quantize models/ggml-tiny.en.bin models/ggml-tiny.en-q4_0.bin q4_0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
- master
|
| 7 |
pull_request:
|
| 8 |
types: [opened, synchronize, reopened]
|
| 9 |
+
workflow_dispatch:
|
| 10 |
+
inputs:
|
| 11 |
+
create_release:
|
| 12 |
+
description: 'Create new release'
|
| 13 |
+
required: true
|
| 14 |
+
type: boolean
|
| 15 |
+
pre_release_tag:
|
| 16 |
+
description: 'Pre-release tag name'
|
| 17 |
+
required: false
|
| 18 |
+
type: string
|
| 19 |
+
run_type:
|
| 20 |
+
description: 'Workflow type to run'
|
| 21 |
+
required: true
|
| 22 |
+
type: choice
|
| 23 |
+
options:
|
| 24 |
+
- full-ci
|
| 25 |
+
- release-only
|
| 26 |
|
| 27 |
concurrency:
|
| 28 |
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
|
| 29 |
cancel-in-progress: true
|
| 30 |
|
| 31 |
+
permissions:
|
| 32 |
+
contents: write # for creating release
|
| 33 |
+
|
| 34 |
env:
|
| 35 |
ubuntu_image: "ubuntu:22.04"
|
| 36 |
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
|
| 37 |
|
| 38 |
jobs:
|
| 39 |
+
determine-tag:
|
| 40 |
+
runs-on: ubuntu-latest
|
| 41 |
+
outputs:
|
| 42 |
+
tag_name: ${{ steps.tag.outputs.name }}
|
| 43 |
+
|
| 44 |
+
steps:
|
| 45 |
+
- name: Checkout with full history
|
| 46 |
+
uses: actions/checkout@v4
|
| 47 |
+
with:
|
| 48 |
+
fetch-depth: 0
|
| 49 |
+
|
| 50 |
+
- name: Determine tag name
|
| 51 |
+
id: tag
|
| 52 |
+
shell: bash
|
| 53 |
+
run: |
|
| 54 |
+
BUILD_NUMBER=$(git rev-list --count HEAD)
|
| 55 |
+
SHORT_HASH=$(git rev-parse --short=7 HEAD)
|
| 56 |
+
CUSTOM_TAG="${{ github.event.inputs.pre_release_tag }}"
|
| 57 |
+
|
| 58 |
+
echo "Raw values:"
|
| 59 |
+
echo "BUILD_NUMBER: $BUILD_NUMBER"
|
| 60 |
+
echo "SHORT_HASH: $SHORT_HASH"
|
| 61 |
+
echo "BRANCH_NAME: ${{ env.BRANCH_NAME }}"
|
| 62 |
+
echo "CUSTOM_TAG: $CUSTOM_TAG"
|
| 63 |
+
|
| 64 |
+
# Use custom tag if provided
|
| 65 |
+
if [[ -n "$CUSTOM_TAG" ]]; then
|
| 66 |
+
echo "Using custom tag"
|
| 67 |
+
TAG_NAME="${CUSTOM_TAG}"
|
| 68 |
+
elif [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
|
| 69 |
+
echo "Using master branch format"
|
| 70 |
+
TAG_NAME="b${BUILD_NUMBER}"
|
| 71 |
+
else
|
| 72 |
+
echo "Using non-master branch format"
|
| 73 |
+
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
|
| 74 |
+
TAG_NAME="${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}"
|
| 75 |
+
fi
|
| 76 |
+
|
| 77 |
+
echo "Final tag name: $TAG_NAME"
|
| 78 |
+
echo "name=$TAG_NAME" >> $GITHUB_OUTPUT
|
| 79 |
+
|
| 80 |
ubuntu-22:
|
| 81 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 82 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 83 |
runs-on: ubuntu-22.04
|
| 84 |
|
| 85 |
strategy:
|
|
|
|
| 106 |
cmake --build build --config Release -j $(nproc)'
|
| 107 |
|
| 108 |
ubuntu-22-arm64:
|
| 109 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 110 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 111 |
runs-on: ubuntu-22.04
|
| 112 |
|
| 113 |
strategy:
|
|
|
|
| 134 |
cmake --build build --config Release -j $(nproc)'
|
| 135 |
|
| 136 |
ubuntu-22-arm-v7:
|
| 137 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 138 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 139 |
runs-on: ubuntu-22.04
|
| 140 |
|
| 141 |
strategy:
|
|
|
|
| 162 |
cmake --build build --config Release -j $(nproc)'
|
| 163 |
|
| 164 |
macOS-latest:
|
| 165 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 166 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 167 |
runs-on: macOS-latest
|
| 168 |
|
| 169 |
strategy:
|
|
|
|
| 198 |
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
|
| 199 |
cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
|
| 200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
# freeBSD-latest:
|
| 203 |
# runs-on: macos-12
|
|
|
|
| 218 |
# cmake --build build --config Release
|
| 219 |
|
| 220 |
ubuntu-22-gcc:
|
| 221 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 222 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 223 |
runs-on: ubuntu-22.04
|
| 224 |
|
| 225 |
strategy:
|
|
|
|
| 248 |
ctest -L gh --output-on-failure'
|
| 249 |
|
| 250 |
ubuntu-22-gcc-arm64:
|
| 251 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 252 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 253 |
runs-on: ubuntu-22.04
|
| 254 |
|
| 255 |
strategy:
|
|
|
|
| 278 |
ctest -L gh --output-on-failure'
|
| 279 |
|
| 280 |
ubuntu-22-gcc-arm-v7:
|
| 281 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 282 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 283 |
runs-on: ubuntu-22.04
|
| 284 |
|
| 285 |
strategy:
|
|
|
|
| 308 |
ctest -L gh --output-on-failure'
|
| 309 |
|
| 310 |
ubuntu-22-clang:
|
| 311 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 312 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 313 |
runs-on: ubuntu-22.04
|
| 314 |
|
| 315 |
strategy:
|
|
|
|
| 341 |
ctest -L gh --output-on-failure'
|
| 342 |
|
| 343 |
ubuntu-22-gcc-sanitized:
|
| 344 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 345 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 346 |
runs-on: ubuntu-22.04
|
| 347 |
|
| 348 |
strategy:
|
|
|
|
| 371 |
ctest -L gh --output-on-failure'
|
| 372 |
|
| 373 |
ubuntu-22-cmake-sycl:
|
| 374 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 375 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 376 |
runs-on: ubuntu-22.04
|
| 377 |
|
| 378 |
strategy:
|
|
|
|
| 423 |
cmake --build . --config Release -j $(nproc)
|
| 424 |
|
| 425 |
ubuntu-22-cmake-sycl-fp16:
|
| 426 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 427 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 428 |
runs-on: ubuntu-22.04
|
| 429 |
|
| 430 |
strategy:
|
|
|
|
| 475 |
cmake --build . --config Release -j $(nproc)
|
| 476 |
|
| 477 |
windows-msys2:
|
| 478 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 479 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 480 |
runs-on: windows-latest
|
| 481 |
|
| 482 |
strategy:
|
|
|
|
| 521 |
cmake --build build --config ${{ matrix.build }} -j $(nproc)
|
| 522 |
|
| 523 |
windows:
|
| 524 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 525 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 526 |
runs-on: windows-latest
|
| 527 |
|
| 528 |
strategy:
|
|
|
|
| 583 |
path: build/bin/${{ matrix.build }}
|
| 584 |
|
| 585 |
windows-blas:
|
| 586 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 587 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 588 |
runs-on: windows-latest
|
| 589 |
|
| 590 |
strategy:
|
|
|
|
| 658 |
path: build/bin/${{ matrix.build }}
|
| 659 |
|
| 660 |
windows-cublas:
|
| 661 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 662 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 663 |
runs-on: windows-2019
|
| 664 |
strategy:
|
| 665 |
matrix:
|
|
|
|
| 728 |
path: build/bin/${{ matrix.build }}
|
| 729 |
|
| 730 |
emscripten:
|
| 731 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 732 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 733 |
runs-on: ubuntu-22.04
|
| 734 |
|
| 735 |
strategy:
|
|
|
|
| 753 |
|
| 754 |
ios-xcode-build:
|
| 755 |
runs-on: macos-latest
|
| 756 |
+
needs: determine-tag
|
| 757 |
|
| 758 |
strategy:
|
| 759 |
matrix:
|
|
|
|
| 796 |
- name: Build swiftui example
|
| 797 |
run: xcodebuild -project examples/whisper.swiftui/whisper.swiftui.xcodeproj -scheme WhisperCppDemo -configuration ${{ matrix.build }} -sdk iphoneos CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= -destination 'generic/platform=iOS' FRAMEWORK_FOLDER_PATH=./build-ios build
|
| 798 |
|
| 799 |
+
- name: Pack artifacts
|
| 800 |
+
id: pack_artifacts
|
| 801 |
+
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') ||
|
| 802 |
+
github.event.inputs.create_release == 'true' ||
|
| 803 |
+
github.event.inputs.pre_release_tag != '' }}
|
| 804 |
+
run: |
|
| 805 |
+
zip --symlinks -r whisper-${{ needs.determine-tag.outputs.tag_name }}-xcframework.zip build-apple/whisper.xcframework
|
| 806 |
+
|
| 807 |
+
- name: Upload artifacts
|
| 808 |
+
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') ||
|
| 809 |
+
github.event.inputs.create_release == 'true' ||
|
| 810 |
+
github.event.inputs.pre_release_tag != '' }}
|
| 811 |
+
uses: actions/upload-artifact@v4
|
| 812 |
+
with:
|
| 813 |
+
path: whisper-${{ needs.determine-tag.outputs.tag_name }}-xcframework.zip
|
| 814 |
+
name: whisper-${{ needs.determine-tag.outputs.tag_name }}-xcframework
|
| 815 |
+
|
| 816 |
android:
|
| 817 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 818 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 819 |
runs-on: ubuntu-22.04
|
| 820 |
|
| 821 |
steps:
|
|
|
|
| 915 |
# PGP_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
| 916 |
|
| 917 |
quantize:
|
| 918 |
+
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' ||
|
| 919 |
+
github.event.inputs.run_type == 'full-ci' }}
|
| 920 |
runs-on: ubuntu-22.04
|
| 921 |
|
| 922 |
steps:
|
|
|
|
| 929 |
cmake -B build
|
| 930 |
cmake --build build --config Release
|
| 931 |
./build/bin/quantize models/ggml-tiny.en.bin models/ggml-tiny.en-q4_0.bin q4_0
|
| 932 |
+
|
| 933 |
+
release:
|
| 934 |
+
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') ||
|
| 935 |
+
github.event.inputs.create_release == 'true' ||
|
| 936 |
+
github.event.inputs.pre_release_tag != '' }}
|
| 937 |
+
|
| 938 |
+
runs-on: ubuntu-latest
|
| 939 |
+
|
| 940 |
+
needs:
|
| 941 |
+
- determine-tag
|
| 942 |
+
- ios-xcode-build
|
| 943 |
+
|
| 944 |
+
steps:
|
| 945 |
+
- name: Clone
|
| 946 |
+
id: checkout
|
| 947 |
+
uses: actions/checkout@v4
|
| 948 |
+
with:
|
| 949 |
+
fetch-depth: 0
|
| 950 |
+
|
| 951 |
+
- name: ccache
|
| 952 |
+
uses: hendrikmuhs/[email protected]
|
| 953 |
+
with:
|
| 954 |
+
key: release
|
| 955 |
+
evict-old-files: 1d
|
| 956 |
+
|
| 957 |
+
# Downloads all the artifacts from the previous jobs
|
| 958 |
+
- name: Download artifacts
|
| 959 |
+
id: download-artifact
|
| 960 |
+
uses: actions/download-artifact@v4
|
| 961 |
+
with:
|
| 962 |
+
path: ./artifact
|
| 963 |
+
|
| 964 |
+
- name: Move artifacts
|
| 965 |
+
id: move_artifacts
|
| 966 |
+
run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release
|
| 967 |
+
|
| 968 |
+
- name: Create release
|
| 969 |
+
id: create_release
|
| 970 |
+
uses: ggml-org/action-create-release@v1
|
| 971 |
+
env:
|
| 972 |
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 973 |
+
with:
|
| 974 |
+
tag_name: ${{ needs.determine-tag.outputs.tag_name }}
|
| 975 |
+
prerelease: ${{ github.event.inputs.pre_release_tag != '' }}
|
| 976 |
+
|
| 977 |
+
- name: Upload release
|
| 978 |
+
id: upload_release
|
| 979 |
+
uses: actions/github-script@v3
|
| 980 |
+
with:
|
| 981 |
+
github-token: ${{secrets.GITHUB_TOKEN}}
|
| 982 |
+
script: |
|
| 983 |
+
const path = require('path');
|
| 984 |
+
const fs = require('fs');
|
| 985 |
+
const release_id = '${{ steps.create_release.outputs.id }}';
|
| 986 |
+
for (let file of await fs.readdirSync('./artifact/release')) {
|
| 987 |
+
if (path.extname(file) === '.zip') {
|
| 988 |
+
console.log('uploadReleaseAsset', file);
|
| 989 |
+
await github.repos.uploadReleaseAsset({
|
| 990 |
+
owner: context.repo.owner,
|
| 991 |
+
repo: context.repo.repo,
|
| 992 |
+
release_id: release_id,
|
| 993 |
+
name: file,
|
| 994 |
+
data: await fs.readFileSync(`./artifact/release/${file}`)
|
| 995 |
+
});
|
| 996 |
+
}
|
| 997 |
+
}
|