From aed4560fefdbc9f569a9b610e8ef351d1eabcfb2 Mon Sep 17 00:00:00 2001 From: mikecarr Date: Thu, 30 Jan 2025 08:52:24 -0800 Subject: [PATCH] Update build_and_release_all.yml --- .github/workflows/build_and_release_all.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_and_release_all.yml b/.github/workflows/build_and_release_all.yml index aeee180..4fd51e3 100644 --- a/.github/workflows/build_and_release_all.yml +++ b/.github/workflows/build_and_release_all.yml @@ -33,25 +33,21 @@ jobs: with: dotnet-version: '8.0.x' - - name: Read Version from VERSION File + - name: Read Version id: get_version run: | if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - # Manual run: use the current branch or a default version - BRANCH_NAME=${{ github.ref_name }} - SANITIZED_BRANCH=$(echo "$BRANCH_NAME" | tr '/' '-' | tr -d '[:space:]') - VERSION="$SANITIZED_BRANCH-$(git rev-parse --short HEAD)" # Use branch name and commit hash + if [[ "${{ inputs.branch }}" == refs/heads/* ]]; then + VERSION="0.0.1" + else + VERSION="${{ inputs.branch }}" + fi elif [[ "${{ github.ref_type }}" == "tag" ]]; then - # Tag run: extract the version from the tag VERSION=${GITHUB_REF#refs/tags/} - VERSION=${VERSION#release-v} # Remove "release-v" prefix + VERSION=${VERSION#release-v} else - # Branch run: use branch name and commit hash - BRANCH_NAME=${{ github.ref_name }} - SANITIZED_BRANCH=$(echo "$BRANCH_NAME" | tr '/' '-' | tr -d '[:space:]') - VERSION="$SANITIZED_BRANCH-$(git rev-parse --short HEAD)" # Use branch name and commit hash + VERSION="0.0.1" fi - echo "VERSION=$VERSION" >> $GITHUB_ENV echo "v$VERSION" > OpenIPC_Config/VERSION shell: bash