release: v0.1.2 #7
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*.*.*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Tag to release" | |
| required: true | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| create-github-release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tag_name: ${{ steps.set-tag.outputs.tag }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set tag name | |
| id: set-tag | |
| run: echo "tag=${{ github.event.inputs.tag || github.ref_name }}" >> "$GITHUB_OUTPUT" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: "3.12" | |
| enable-cache: true | |
| - name: Check version consistency | |
| run: | | |
| VERSION=$(grep -m 1 'version = ' pyproject.toml | cut -d '"' -f 2) | |
| TAG=${{ steps.set-tag.outputs.tag }} | |
| CLEAN_TAG=${TAG#v} | |
| if [ "$VERSION" != "$CLEAN_TAG" ]; then | |
| echo "Version in pyproject.toml ($VERSION) does not match tag ($TAG)" | |
| exit 1 | |
| fi | |
| - name: Build distribution | |
| run: uv build | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.set-tag.outputs.tag }} | |
| name: ${{ steps.set-tag.outputs.tag }} | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: ${{ contains(steps.set-tag.outputs.tag, 'a') || contains(steps.set-tag.outputs.tag, 'b') || contains(steps.set-tag.outputs.tag, 'rc') }} | |
| files: | | |
| dist/*.whl | |
| dist/*.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-to-pypi: | |
| name: Publish to PyPI | |
| needs: [create-github-release] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/project/lsap-sdk/ | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: "3.12" | |
| enable-cache: true | |
| - name: Build distribution | |
| run: uv build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |