Skip to content

Commit 202b1e7

Browse files
committed
ci : allow creating artifacts on PRs on demand
1 parent c5d9eff commit 202b1e7

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ env:
3131
LLAMA_LOG_COLORS: 1
3232
LLAMA_LOG_PREFIX: 1
3333
LLAMA_LOG_TIMESTAMPS: 1
34+
CREATE_RELEASE: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' || contains(github.event.head_commit.message, '[pack]') }}
3435

3536
jobs:
3637
macOS-latest-cmake-arm64:
@@ -85,14 +86,14 @@ jobs:
8586
8687
- name: Pack artifacts
8788
id: pack_artifacts
88-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
89+
if: ${{ env.CREATE_RELEASE }}
8990
run: |
9091
cp LICENSE ./build/bin/
9192
cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp
9293
zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip ./build/bin/*
9394
9495
- name: Upload artifacts
95-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
96+
if: ${{ env.CREATE_RELEASE }}
9697
uses: actions/upload-artifact@v4
9798
with:
9899
path: llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip
@@ -149,14 +150,14 @@ jobs:
149150
150151
- name: Pack artifacts
151152
id: pack_artifacts
152-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
153+
if: ${{ env.CREATE_RELEASE }}
153154
run: |
154155
cp LICENSE ./build/bin/
155156
cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp
156157
zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip ./build/bin/*
157158
158159
- name: Upload artifacts
159-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
160+
if: ${{ env.CREATE_RELEASE }}
160161
uses: actions/upload-artifact@v4
161162
with:
162163
path: llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip
@@ -221,14 +222,14 @@ jobs:
221222
222223
- name: Pack artifacts
223224
id: pack_artifacts
224-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
225+
if: ${{ env.CREATE_RELEASE }}
225226
run: |
226227
cp LICENSE ./build/bin/
227228
cp examples/run/linenoise.cpp/LICENSE ./build/bin/LICENSE.linenoise.cpp
228229
zip -r llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip ./build/bin/*
229230
230231
- name: Upload artifacts
231-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
232+
if: ${{ env.CREATE_RELEASE }}
232233
uses: actions/upload-artifact@v4
233234
with:
234235
path: llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip
@@ -790,14 +791,14 @@ jobs:
790791
791792
- name: Pack artifacts
792793
id: pack_artifacts
793-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
794+
if: ${{ env.CREATE_RELEASE }}
794795
run: |
795796
Copy-Item LICENSE .\build\bin\Release\llama.cpp.txt
796797
Copy-Item .\examples\run\linenoise.cpp\LICENSE .\build\bin\Release\linenoise.cpp.txt
797798
7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip .\build\bin\Release\*
798799
799800
- name: Upload artifacts
800-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
801+
if: ${{ env.CREATE_RELEASE }}
801802
uses: actions/upload-artifact@v4
802803
with:
803804
path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip
@@ -940,19 +941,19 @@ jobs:
940941
941942
- name: Pack artifacts
942943
id: pack_artifacts
943-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
944+
if: ${{ env.CREATE_RELEASE }}
944945
run: |
945946
7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip .\build\bin\Release\*
946947
947948
- name: Upload artifacts
948-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
949+
if: ${{ env.CREATE_RELEASE }}
949950
uses: actions/upload-artifact@v4
950951
with:
951952
path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip
952953
name: llama-bin-win-cu${{ matrix.cuda }}-x64.zip
953954

954955
- name: Copy and pack Cuda runtime
955-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
956+
if: ${{ env.CREATE_RELEASE }}
956957
run: |
957958
echo "Cuda install location: ${{ env.CUDA_PATH }}"
958959
$dst='.\build\bin\cudart\'
@@ -961,7 +962,7 @@ jobs:
961962
7z a cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip $dst\*
962963
963964
- name: Upload Cuda runtime
964-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
965+
if: ${{ env.CREATE_RELEASE }}
965966
uses: actions/upload-artifact@v4
966967
with:
967968
path: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
@@ -1008,7 +1009,7 @@ jobs:
10081009
10091010
- name: Build the release package
10101011
id: pack_artifacts
1011-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
1012+
if: ${{ env.CREATE_RELEASE }}
10121013
run: |
10131014
echo "cp oneAPI running time dll files in ${{ env.ONEAPI_ROOT }} to ./build/bin"
10141015
@@ -1033,7 +1034,7 @@ jobs:
10331034
7z a llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip ./build/bin/*
10341035
10351036
- name: Upload the release package
1036-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
1037+
if: ${{ env.CREATE_RELEASE }}
10371038
uses: actions/upload-artifact@v4
10381039
with:
10391040
path: llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip
@@ -1077,7 +1078,7 @@ jobs:
10771078
cmake --build build -j ${env:NUMBER_OF_PROCESSORS}
10781079
10791080
windows-latest-cmake-hip-release:
1080-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
1081+
if: ${{ env.CREATE_RELEASE }}
10811082
runs-on: windows-latest
10821083

10831084
strategy:

0 commit comments

Comments
 (0)