attempt to fix release tag with branch #32
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' # Trigger on semantic versioning tags | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Get version from tag | |
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 | |
pip install setuptools wheel setuptools-scm | |
- name: Build package | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Upload Package to Release | |
if: startsWith(github.ref, 'refs/tags/v') # Run this step if the tag starts with 'v' | |
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 | |
files: | | |
dist/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |