ci : add support for tag-based releases (#3287)

This commit modifies the GitHub Actions workflow to support
tag-based releases. When a tag is pushed that starts with 'v', the
workflow will use that tag name for the release process.

I think this was the once the behavior, but it was lost in updates that
I've made to the workflow. This commit restores that functionality.
This commit is contained in:
Daniel Bevenius 2025-06-25 21:43:58 +02:00 committed by GitHub
parent a8d002cfd8
commit 4daf7050ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,8 @@ on:
push: push:
branches: branches:
- master - master
tags:
- 'v*'
pull_request: pull_request:
types: [opened, synchronize, reopened] types: [opened, synchronize, reopened]
workflow_dispatch: workflow_dispatch:
@ -62,8 +64,11 @@ jobs:
echo "BRANCH_NAME: ${{ env.BRANCH_NAME }}" echo "BRANCH_NAME: ${{ env.BRANCH_NAME }}"
echo "CUSTOM_TAG: $CUSTOM_TAG" echo "CUSTOM_TAG: $CUSTOM_TAG"
if [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "Using pushed tag name"
TAG_NAME="${{ github.ref_name }}"
# Use custom tag if provided # Use custom tag if provided
if [[ -n "$CUSTOM_TAG" ]]; then elif [[ -n "$CUSTOM_TAG" ]]; then
echo "Using custom tag" echo "Using custom tag"
TAG_NAME="${CUSTOM_TAG}" TAG_NAME="${CUSTOM_TAG}"
elif [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then elif [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
@ -1226,7 +1231,8 @@ jobs:
./build/bin/quantize models/ggml-tiny.en.bin models/ggml-tiny.en-q4_0.bin q4_0 ./build/bin/quantize models/ggml-tiny.en.bin models/ggml-tiny.en-q4_0.bin q4_0
release: release:
if: ${{ github.event.inputs.create_release == 'true' || github.event.inputs.pre_release_tag != '' }} if: ${{ github.event.inputs.create_release == 'true' || github.event.inputs.pre_release_tag != '' || startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest runs-on: ubuntu-latest