|
| 1 | +name: UV - Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +jobs: |
| 9 | + Semantic-Release: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + outputs: |
| 12 | + tag: ${{ steps.release.outputs.tag }} |
| 13 | + concurrency: |
| 14 | + group: ${{ github.workflow }}-release-${{ github.ref_name }} |
| 15 | + cancel-in-progress: false |
| 16 | + permissions: |
| 17 | + contents: write |
| 18 | + env: |
| 19 | + dist_artifacts_name: dist |
| 20 | + dist_artifacts_dir: dist |
| 21 | + lock_file_artifact: uv.lock |
| 22 | + UV_VERSION: '0.9.28' |
| 23 | + PYTHON_VERSION: '3.13' |
| 24 | + GITHUB_ACTIONS_AUTHOR_NAME: github-actions |
| 25 | + GITHUB_ACTIONS_AUTHOR_EMAIL: actions@users.noreply.github.com |
| 26 | + steps: |
| 27 | + - name: Setup | Checkout Repository on Release Branch |
| 28 | + uses: actions/checkout@v6 |
| 29 | + with: |
| 30 | + ref: ${{ github.ref_name }} |
| 31 | + |
| 32 | + - name: Setup | Force release branch to be at workflow sha |
| 33 | + run: | |
| 34 | + git reset --hard ${{ github.sha }} |
| 35 | +
|
| 36 | + - name: Restore global uv cache |
| 37 | + id: cache-restore |
| 38 | + uses: actions/cache/restore@v4 |
| 39 | + with: |
| 40 | + path: | |
| 41 | + ~/.cache/uv |
| 42 | + ~/.local/share/uv |
| 43 | + .venv |
| 44 | + key: uv-main-${{ env.UV_VERSION }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('pyproject.toml', 'uv.lock') }} |
| 45 | + restore-keys: | |
| 46 | + uv-main- |
| 47 | +
|
| 48 | + - name: Install uv |
| 49 | + uses: astral-sh/setup-uv@v7 |
| 50 | + with: |
| 51 | + version: ${{ env.UV_VERSION }} |
| 52 | + python-version: ${{ env.PYTHON_VERSION }} |
| 53 | + enable-cache: false |
| 54 | + |
| 55 | + - name: Action | Semantic Version Release |
| 56 | + id: release |
| 57 | + uses: python-semantic-release/python-semantic-release@v10.5.3 |
| 58 | + with: |
| 59 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 60 | + git_committer_name: 'github-actions' |
| 61 | + git_committer_email: 'actions@users.noreply.github.com' |
| 62 | + |
| 63 | + - name: Publish | Upload to GitHub Release Assets |
| 64 | + uses: python-semantic-release/publish-action@v10.5.3 |
| 65 | + if: steps.release.outputs.released == 'true' |
| 66 | + with: |
| 67 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + tag: ${{ steps.release.outputs.tag }} |
| 69 | + |
| 70 | + - name: Save uv caches |
| 71 | + if: steps.cache-restore.outputs.cache-hit != 'true' |
| 72 | + uses: actions/cache/save@v4 |
| 73 | + with: |
| 74 | + path: | |
| 75 | + ~/.cache/uv |
| 76 | + ~/.local/share/uv |
| 77 | + .venv |
| 78 | + key: uv-main-${{ env.UV_VERSION }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('pyproject.toml', 'uv.lock') }} |
0 commit comments