|
| 1 | +name: Buld and Publish |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +env: |
| 9 | + UV_NATIVE_TLS: 1 |
| 10 | + |
| 11 | +jobs: |
| 12 | + commitlint: |
| 13 | + name: Build and Publish Tagged Release |
| 14 | + runs-on: ubuntu-24.04 |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout Project |
| 18 | + uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Install uv |
| 21 | + uses: astral-sh/setup-uv@v5 |
| 22 | + with: |
| 23 | + enable-cache: true |
| 24 | + cache-dependency-glob: "uv.lock" |
| 25 | + |
| 26 | + - name: Prepare Python Env |
| 27 | + uses: actions/setup-python@v5 |
| 28 | + with: |
| 29 | + python-version-file: "pyproject.toml" |
| 30 | + |
| 31 | + - name: Install the project |
| 32 | + shell: bash |
| 33 | + run: | |
| 34 | + uv sync --all-extras --dev |
| 35 | +
|
| 36 | + - name: Build 📦 package |
| 37 | + run: | |
| 38 | + uv build |
| 39 | + shell: bash |
| 40 | + |
| 41 | + - name: Upload artifacts |
| 42 | + if: github.event_name == 'push' |
| 43 | + uses: actions/upload-artifact@v4 |
| 44 | + with: |
| 45 | + name: python-inspector-cariad |
| 46 | + path: dist/python_inspector_cariad-*-py3-none-any.whl |
| 47 | + overwrite: true |
| 48 | + |
| 49 | + - name: Find Wheel File |
| 50 | + id: find_whl |
| 51 | + run: echo "WHL_FILE=$(ls dist/python_inspector_cariad-*-py3-none-any.whl)" >> $GITHUB_ENV |
| 52 | + |
| 53 | + - name: Create Release |
| 54 | + if: startsWith(github.ref, 'refs/tags/') |
| 55 | + id: create_release |
| 56 | + uses: actions/create-release@v1 |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + with: |
| 60 | + tag_name: ${{ github.ref }} |
| 61 | + release_name: Release ${{ github.ref }} |
| 62 | + draft: false |
| 63 | + prerelease: false |
| 64 | + |
| 65 | + - name: Upload Release Asset |
| 66 | + if: startsWith(github.ref, 'refs/tags/') |
| 67 | + id: upload-release-asset |
| 68 | + uses: actions/upload-release-asset@v1 |
| 69 | + env: |
| 70 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + with: |
| 72 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 73 | + asset_path: ${{ env.WHL_FILE }} |
| 74 | + asset_name: $(basename ${{ env.WHL_FILE }}) |
| 75 | + asset_content_type: application/zip |
0 commit comments