Skip to content

Commit

Permalink
add check-tag job to see if we're on a release/prerelease tag
Browse files Browse the repository at this point in the history
  • Loading branch information
mcflugen committed Oct 10, 2024
1 parent 46a7734 commit 1003efe
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@ name: Test
on: [push, pull_request]

jobs:
check-tag:
runs-on: ubuntu-latest
outputs:
publish_url: ${{ steps.check-publish.outputs.publish_url }}

steps:
- name: Check if this is a release/prerelease
id: check-publish
run: |
tag_name="${GITHUB_REF#refs/tags/}"
if [[ "$tag_name" =~ ^v[0-9]+\.[0-9]+\.[0-9]+[ab][0-9]+$ ]]; then
publish_url="https://test.pypi.org/legacy/"
elif [[ "$tag_name" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
publish_url="https://upload.pypi.org/legacy/"
else
publish_url="none"
fi
echo "publish_url=$publish_url" >> "$GITHUB_OUTPUT"
echo "tag_name=$tag_name"
echo "publish_url=$publish_url"
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
Expand Down

0 comments on commit 1003efe

Please sign in to comment.