try pypi workflow on release #40
This file contains 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 and Release Python Wheel | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-release: | |
if: contains(github.event.head_commit.message, 'release') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Hatch | |
run: pip install hatch | |
- name: Build | |
run: hatch build | |
- name: Create a Release | |
run: | | |
RELEASE_DATE=$(date +'%Y-%m-%d') | |
VERSION=$(cat pyproject.toml | cut -d'"' -f2) | |
gh release create "${UNIQUE_TAG}" dist/affinity-*.whl --title "Release ${VERSION} (${RELEASE_DATE})" | |
# git tag -f latest | |
# git push origin latest --force | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload built package as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ |