Switch build backend from uv_build to hatchling #2
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: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract version from tag | |
| id: version | |
| run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| - name: Verify version matches pyproject.toml | |
| run: | | |
| project_version=$(python3 -c " | |
| import re | |
| with open('pyproject.toml') as f: | |
| match = re.search(r'version\s*=\s*\"(.+?)\"', f.read()) | |
| print(match.group(1)) | |
| ") | |
| if [ "$project_version" != "${{ steps.version.outputs.version }}" ]; then | |
| echo "::error::Tag version (${{ steps.version.outputs.version }}) does not match pyproject.toml version ($project_version)" | |
| exit 1 | |
| fi | |
| - name: Create GitHub Release | |
| run: | | |
| gh release create "$GITHUB_REF_NAME" \ | |
| --title "Grove ${{ steps.version.outputs.version }}" \ | |
| --generate-notes | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update Homebrew tap | |
| env: | |
| TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }} | |
| run: | | |
| # Compute SHA256 of the release tarball | |
| tarball_url="https://github.com/${{ github.repository }}/archive/refs/tags/${GITHUB_REF_NAME}.tar.gz" | |
| sha256=$(curl -sL "$tarball_url" | sha256sum | awk '{print $1}') | |
| # Clone the tap repo | |
| git clone "https://x-access-token:${TAP_GITHUB_TOKEN}@github.com/nicksenap/homebrew-grove.git" tap | |
| cd tap | |
| # Update formula version URL and tarball SHA (first sha256 only) | |
| sed -i "s|url \"https://github.com/.*/archive/refs/tags/v.*\.tar\.gz\"|url \"${tarball_url}\"|" Formula/grove.rb | |
| sed -i "0,/sha256 \".*\"/s/sha256 \".*\"/sha256 \"${sha256}\"/" Formula/grove.rb | |
| # Commit and push | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Formula/grove.rb | |
| git diff --cached --quiet && exit 0 | |
| git commit -m "grove ${{ steps.version.outputs.version }}" | |
| git push |