Increment version #35
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 | |
| permissions: | |
| contents: write | |
| id-token: write | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| jobs: | |
| test: | |
| uses: ./.github/workflows/test.yml | |
| build: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/asyncapi-python | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install UV | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Version Check and population of PROJECT_VERSION var | |
| run: | | |
| PROJECT_VERSION=$(uv run python -c "import importlib.metadata; print(importlib.metadata.version('asyncapi-python'))") | |
| TAG=$(git describe HEAD --tags --abbrev=0) | |
| echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV | |
| echo "Project version: $PROJECT_VERSION" | |
| echo "Git tag: $TAG" | |
| if [[ "$TAG" != "v$PROJECT_VERSION" ]]; then | |
| echo "Version mismatch: Tag '$TAG' does not match project version 'v$PROJECT_VERSION'" | |
| exit 1 | |
| fi | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: ${{ github.ref }} | |
| draft: true | |
| prerelease: ${{ contains(github.ref, 'rc') }} | |
| - name: Build sdist and wheel | |
| run: | | |
| mkdir -p dist | |
| uv build | |
| - name: Upload wheel to Release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./dist/asyncapi_python-${{ env.PROJECT_VERSION }}-py3-none-any.whl | |
| asset_name: asyncapi_python-${{ env.PROJECT_VERSION }}-py3-none-any.whl | |
| asset_content_type: application/x-wheel+zip | |
| - name: Upload sdist to Release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./dist/asyncapi_python-${{ env.PROJECT_VERSION }}.tar.gz | |
| asset_name: asyncapi_python-${{ env.PROJECT_VERSION }}.tar.gz | |
| asset_content_type: application/gzip | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |