Skip to content

Commit ed93f62

Browse files
committed
attempt to fix release tag with branch
1 parent 1f8f858 commit ed93f62

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,21 @@ jobs:
2222

2323
- name: Get version from tag
2424
id: vars
25-
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
25+
run: |
26+
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
27+
28+
- name: Determine Branch
29+
id: determine_branch
30+
run: |
31+
DEFAULT_BRANCH=$(git symbolic-ref --short HEAD)
32+
if [ "$DEFAULT_BRANCH" = "master" ]; then
33+
BRANCH_NAME="master"
34+
elif [ "$DEFAULT_BRANCH" = "next" ]; then
35+
BRANCH_NAME="next"
36+
else
37+
BRANCH_NAME="unknown"
38+
fi
39+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
2640
2741
- name: Install dependencies
2842
run: |
@@ -33,21 +47,12 @@ jobs:
3347
run: |
3448
python setup.py sdist bdist_wheel
3549
36-
- name: Create Release
37-
id: create_release
38-
run: |
39-
TAG_NAME=${GITHUB_REF#refs/tags/}
40-
BRANCH_NAME=$(echo "${GITHUB_REF}" | sed 's/refs\/tags\///') # Correctly extract branch name
41-
echo "Creating release for tag $TAG_NAME on branch $BRANCH_NAME"
42-
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
43-
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
44-
4550
- name: Upload Package to Release
4651
if: startsWith(github.ref, 'refs/tags/v') # Run this step if the tag starts with 'v'
4752
uses: softprops/action-gh-release@v1
4853
with:
49-
tag_name: ${{ env.TAG_NAME }}-${{ env.BRANCH_NAME }} # Tag to create release
50-
release_name: Release ${{ env.TAG_NAME }} from branch ${{ env.BRANCH_NAME }} # Include branch name in release title
54+
tag_name: ${{ env.VERSION }}-${{ env.BRANCH_NAME }} # Tag to create release
55+
release_name: Release ${{ env.VERSION }} from branch ${{ env.BRANCH_NAME }} # Include branch name in release title
5156
files: |
5257
dist/*
5358
env:

0 commit comments

Comments
 (0)