Skip to content

Commit 4f95ca8

Browse files
DannyDaemonicakawrykow
authored andcommitted
Tag release with build number (ggml-org#2732)
* Modified build.yml to use build number for release * Add the short hash back into the tag * Prefix the build number with b
1 parent 9789cd2 commit 4f95ca8

File tree

1 file changed

+46
-17
lines changed

1 file changed

+46
-17
lines changed

.github/workflows/build.yml

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -291,24 +291,32 @@ jobs:
291291
cd build
292292
ctest -C Release --verbose --timeout 900
293293
294-
- name: Get commit hash
295-
id: commit
296-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
297-
uses: pr-mpt/actions-commit-hash@v2
294+
- name: Determine tag name
295+
id: tag
296+
shell: bash
297+
run: |
298+
BUILD_NUMBER="$(git rev-list --count HEAD)"
299+
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
300+
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
301+
echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
302+
else
303+
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
304+
echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
305+
fi
298306
299307
- name: Pack artifacts
300308
id: pack_artifacts
301309
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
302310
run: |
303311
Copy-Item LICENSE .\build\bin\Release\llama.cpp.txt
304-
7z a llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip .\build\bin\Release\*
312+
7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-x64.zip .\build\bin\Release\*
305313
306314
- name: Upload artifacts
307315
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
308316
uses: actions/upload-artifact@v3
309317
with:
310318
path: |
311-
llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip
319+
llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-x64.zip
312320
313321
windows-latest-cmake-cublas:
314322
runs-on: windows-latest
@@ -338,23 +346,31 @@ jobs:
338346
cmake .. -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUBLAS=ON
339347
cmake --build . --config Release
340348
341-
- name: Get commit hash
342-
id: commit
343-
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
344-
uses: pr-mpt/actions-commit-hash@v2
349+
- name: Determine tag name
350+
id: tag
351+
shell: bash
352+
run: |
353+
BUILD_NUMBER="$(git rev-list --count HEAD)"
354+
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
355+
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
356+
echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
357+
else
358+
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
359+
echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
360+
fi
345361
346362
- name: Pack artifacts
347363
id: pack_artifacts
348364
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
349365
run: |
350-
7z a llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip .\build\bin\Release\*
366+
7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip .\build\bin\Release\*
351367
352368
- name: Upload artifacts
353369
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
354370
uses: actions/upload-artifact@v3
355371
with:
356372
path: |
357-
llama-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip
373+
llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip
358374
359375
- name: Copy and pack Cuda runtime
360376
if: ${{ matrix.cuda == '12.1.0' }}
@@ -400,21 +416,34 @@ jobs:
400416
- windows-latest-cmake-cublas
401417

402418
steps:
419+
- name: Clone
420+
id: checkout
421+
uses: actions/checkout@v1
422+
423+
- name: Determine tag name
424+
id: tag
425+
shell: bash
426+
run: |
427+
BUILD_NUMBER="$(git rev-list --count HEAD)"
428+
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
429+
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
430+
echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
431+
else
432+
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
433+
echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
434+
fi
435+
403436
- name: Download artifacts
404437
id: download-artifact
405438
uses: actions/download-artifact@v3
406439

407-
- name: Get commit hash
408-
id: commit
409-
uses: pr-mpt/actions-commit-hash@v2
410-
411440
- name: Create release
412441
id: create_release
413442
uses: anzz1/action-create-release@v1
414443
env:
415444
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
416445
with:
417-
tag_name: ${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}
446+
tag_name: ${{ steps.tag.outputs.name }}
418447

419448
- name: Upload release
420449
id: upload_release

0 commit comments

Comments
 (0)