standardize GET query handling #50
This file contains hidden or 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: Publish to PyPI | |
| # https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | |
| # Controls when the workflow will run | |
| on: | |
| # Triggers the workflow on push for the "main" branch | |
| push: | |
| branches: [ "main" ] | |
| jobs: | |
| pypi-publish: | |
| name: Upload release to PyPI | |
| if: github.repository == 'prelectai/toadr3' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: π Checkout | |
| uses: actions/checkout@main | |
| - name: π Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.12 | |
| - name: 𦀠Install dependencies | |
| run: | | |
| pip install poetry | |
| poetry install | |
| - name: π¦ Fetch package version | |
| run: | | |
| echo "CURRENT_VERSION=v$(poetry version --short)" >> $GITHUB_ENV | |
| echo "Version = v$(poetry version --short)" | |
| - name: π Build package | |
| run: poetry build | |
| - name: π° Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # Check if the version is a pre-release by looking for the presence of 'a', 'b', or 'rc' in the version number. | |
| - name: π·οΈ Create release (or pre-release) | |
| env: | |
| GITHUB_TOKEN: ${{ github.TOKEN }} | |
| shell: bash | |
| run: | | |
| if [[ "${{ env.CURRENT_VERSION }}" == "*(a|b|rc)*" ]]; then | |
| echo "Creating pre-release ${{ env.CURRENT_VERSION }}" | |
| gh release create --prerelease ${{ env.CURRENT_VERSION }} dist/* | |
| else | |
| echo "Creating release ${{ env.CURRENT_VERSION }}" | |
| gh release create ${{ env.CURRENT_VERSION }} dist/* | |
| fi |