chore: update version to 0.1.2 and add GitHub Actions workflow for re… #4
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 and PyPI Publish Workflow | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| jobs: | |
| draft-release: | |
| if: startsWith(github.ref, 'refs/heads/main') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Create/Update release draft | |
| uses: release-drafter/release-drafter@v5 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-to-github-and-pypi: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Build sdist and wheel distributions | |
| run: | | |
| uv build | |
| - name: Get release notes from tag | |
| id: get_release_notes | |
| run: | | |
| TAG_NAME=${{ github.ref_name }} | |
| RELEASE_NOTES=$(git tag -l -n99 "$TAG_NAME" | sed -n '2,$p' | sed 's/^ //') | |
| if [ -z "$RELEASE_NOTES" ]; then | |
| RELEASE_NOTES="No release notes provided for $TAG_NAME." | |
| fi | |
| echo "release_notes<<EOF" >> "$GITHUB_OUTPUT" | |
| echo "$RELEASE_NOTES" >> "$GITHUB_OUTPUT" | |
| echo "EOF" >> "$GITHUB_OUTPUT" | |
| - name: Create GitHub Release | |
| id: create_github_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: Release ${{ github.ref }} | |
| body: ${{ steps.get_release_notes.outputs.release_notes }} | |
| draft: false | |
| prerelease: ${{ contains(github.ref, '-beta') || contains(github.ref, '-rc') }} | |
| - name: Upload Release Asset | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| ./dist/*.whl | |
| ./dist/*.tar.gz | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist/ |