Skip to content

Commit

Permalink
Update build_and_release_all.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecarr authored Jan 30, 2025
1 parent 877dddb commit aed4560
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/build_and_release_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aed4560

Please sign in to comment.