Skip to content

Commit

Permalink
attempt to fix release tag with branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecarr committed Oct 5, 2024
1 parent fbcf834 commit 876d85b
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build and Release
on:
push:
tags:
- 'v*.*.*' # Trigger on semantic versioning tags
- 'v*.*.*' # This triggers the workflow on tags following semantic versioning

jobs:
build:
Expand All @@ -24,19 +24,6 @@ jobs:
id: vars
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Determine Branch
id: determine_branch
run: |
# Find the branch that contains the commit
if git branch -r --contains $GITHUB_SHA | grep "origin/master"; then
BRANCH_NAME="master"
elif git branch -r --contains $GITHUB_SHA | grep "origin/next"; then
BRANCH_NAME="next"
else
BRANCH_NAME="unknown"
fi
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -46,12 +33,25 @@ jobs:
run: |
python setup.py sdist bdist_wheel
- name: Create Release
id: create_release
run: |
if [[ "${GITHUB_REF}" == "refs/tags/v"* ]]; then
TAG_NAME=${GITHUB_REF#refs/tags/}
if [[ "${GITHUB_REF}" == "refs/tags/v"* ]]; then
echo "Creating release for tag $TAG_NAME"
echo "GITHUB_REF=$GITHUB_REF" >> $GITHUB_ENV
fi
else
echo "Not a valid tag, skipping release creation."
exit 0
fi
- name: Upload Package to Release
if: startsWith(github.ref, 'refs/tags/v') # Run this step if the tag starts with 'v'
if: steps.create_release.outputs.tag_name != ''
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}-${{ env.BRANCH_NAME }} # Tag to create release
name: Release ${{ env.VERSION }} from branch ${{ env.BRANCH_NAME }} # Correct input 'name' for release title
tag_name: ${{ steps.create_release.outputs.tag_name }}
files: |
dist/*
env:
Expand Down

0 comments on commit 876d85b

Please sign in to comment.