Skip to content

Bulk asynchronous downloader for multiple file hosts

Update publish-to-pypi.yaml

Jacob3ded7075f85f
diff --git a/.github/workflows/publish-to-pypi.yaml b/.github/workflows/publish-to-pypi.yaml
index e18d0828a..b00375fb3 100644
--- a/.github/workflows/publish-to-pypi.yaml
+++ b/.github/workflows/publish-to-pypi.yaml
@@ -2,13 +2,50 @@ name: Publish To PyPi
on:
push:
+ branches:
+ - master
tags:
- '*.*.*'
jobs:
+ check-version:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Python 3.11.4
+ uses: actions/setup-python@v4
+ with:
+ python-version: "3.11.4"
+
+ - name: Install Poetry
+ run: |
+ curl -sSL https://install.python-poetry.org | python - -y
+
+ - name: Check Version
+ id: check-version
+ run: |
+ version=$(poetry version --short)
+ if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
+ echo "::set-output name=version::$version"
+ else
+ echo "Not a valid version bump. Skipping tag creation."
+ exit 0
+ fi
+
+ - name: Create Tag
+ if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.check-version.outputs.version != '' }}
+ run: |
+ git config user.name "GitHub Actions"
+ git config user.email "[email protected]"
+ git tag ${{ steps.check-version.outputs.version }}
+ git push origin ${{ steps.check-version.outputs.version }}
+
release:
- name: Release
runs-on: ubuntu-latest
+ needs: check-version
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -28,12 +65,7 @@ jobs:
- name: Build project for distribution
run: poetry build
- - name: Check Version
- id: check-version
- run: |
- [[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || echo prerelease=true >> $GITHUB_OUTPUT
-
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
- run: poetry publish
\ No newline at end of file
+ run: poetry publish