Skip to content

Commit

Permalink
ci: update release workflow for dev releases
Browse files Browse the repository at this point in the history
  • Loading branch information
belingud committed Jan 5, 2025
1 parent b6ffb3c commit baf999b
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,20 @@ jobs:
needs: goreleaser
runs-on: ubuntu-latest
outputs:
is_prerelease: ${{ steps.check_tag.outputs.is_prerelease }}
is_dev: ${{ steps.check_tag.outputs.is_dev }}
steps:
- name: Check if version is prerelease
id: check_tag
run: |
VERSION=${GITHUB_REF#refs/tags/}
if [[ $VERSION =~ .*-.*$ ]]; then
echo "is_prerelease=true" >> $GITHUB_OUTPUT
if [[ $VERSION =~ .*-dev$ ]]; then
echo "is_dev=true" >> $GITHUB_OUTPUT
else
echo "is_prerelease=false" >> $GITHUB_OUTPUT
echo "is_dev=false" >> $GITHUB_OUTPUT
fi
python-package:
needs: check-version
if: needs.check-version.outputs.is_prerelease != 'true'
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -171,7 +170,7 @@ jobs:

publish:
needs: [check-version, python-package]
if: needs.check-version.outputs.is_prerelease != 'true'
environment: ${{ needs.check-version.outputs.is_dev == 'true' && 'testpypi' || 'pypi' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -208,4 +207,10 @@ jobs:
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
echo "Publishing to PyPI"
twine upload final_dist/* --verbose --repository-url https://test.pypi.org/legacy/
if ${{ needs.check-version.outputs.is_dev }} == 'true'; then
echo "Publishing to TestPyPI"
twine upload final_dist/* --verbose --repository-url https://test.pypi.org/legacy/
else
echo "Publishing to PyPI"
twine upload final_dist/* --verbose
fi

0 comments on commit baf999b

Please sign in to comment.