build #12
Workflow file for this run
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: build | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| publish-release: | |
| name: publish release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Verify tag is on main branch | |
| run: | | |
| # Get the commit SHA that the tag points to | |
| TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref }}) | |
| echo "Tag commit: $TAG_COMMIT" | |
| # Check if this commit is on the main branch | |
| if ! git branch -r --contains $TAG_COMMIT | grep -q 'origin/main'; then | |
| echo "Error: Tag ${{ github.ref_name }} is not on the main branch" | |
| echo "Releases can only be created from the main branch" | |
| exit 1 | |
| fi | |
| echo "Tag is on main branch, proceeding with release" | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.12 | |
| - name: 🔗 Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install wheel | |
| - name: 💎 Install | |
| run: | | |
| python -m pip install --no-cache-dir -r requirements-dev.txt | |
| - name: 💃 Build release | |
| run: | | |
| python setup.py clean --all sdist bdist_wheel | |
| - name: 📦 Publish release to PyPI | |
| uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 | |
| with: | |
| password: ${{ secrets.pypi_password }} |