feat: Add function to find executable, bump to version 1.0.3 #4
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 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| check-version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| is_new: ${{ steps.check.outputs.is_new }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check if version is new on PyPI | |
| id: check | |
| run: | | |
| VERSION=$(grep '^version' pyproject.toml | sed 's/.*= *"\(.*\)"/\1/') | |
| NAME=$(grep '^name' pyproject.toml | sed 's/.*= *"\(.*\)"/\1/') | |
| STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/${NAME}/${VERSION}/json") | |
| if [ "$STATUS" = "404" ]; then | |
| echo "is_new=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "is_new=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| build: | |
| needs: check-version | |
| if: needs.check-version.outputs.is_new == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install build | |
| run: pip install build | |
| - name: Build package | |
| run: python -m build | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |