Repository navigation
109 lines (97 loc) · 3.72 KB
/
Copy pathUVRelease.yml
File metadata and controls
109 lines (97 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: ⚡Release (UV)
on:
workflow_dispatch:
workflow_call:
inputs:
settings_publish:
required: false
type: string
default: true
settings_token:
required: false
type: string
default: '.'
pypi_publish:
required: false
type: string
default: true
jobs:
release:
name: ⚡ Versioning and Release (UV)
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
runs-on: ubuntu-latest
concurrency: release # Use a different concurrency group if needed?
permissions:
id-token: write
contents: write
steps:
- name: 🔒️ Install 1Password CLI
uses: 1password/install-cli-action@v4
- name: 🔒️ Load credentials
uses: 1password/load-secrets-action@v2
id: secrets
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
TOKEN: "op://git/GITHUB/TOKEN"
PYPI_API_TOKEN: "op://git/PYPI_API_TOKEN/password"
- name: 📥 Checkout the repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.secrets.outputs.TOKEN }}
- name: 🐍 Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: ⬇️ Install uv & semantic-release
run: pip install uv python-semantic-release
- name: 🔖 Semantic Version, Build, Commit, Tag
id: versioning # Give it an ID
env:
GH_TOKEN: ${{ steps.secrets.outputs.TOKEN }}
# Set log level via environment variable (most reliable method)
PSR_LOG_LEVEL: DEBUG
# Run version command - this runs build, updates files, commits, tags
run: |
# if [[ "${{ github.repository }}" == "mraniki/MyLLM" ]]; then
# echo "Forcing minor release for MyLLM repository."
# semantic-release -vv version --minor
# else
echo "Running standard versioning for ${{ github.repository }}."
semantic-release version
#fi
# Try to capture the tag created. semantic-release doesn't output it directly.
# Use git describe as a common way to get the latest tag.
TAG=$(git describe --tags --abbrev=0)
echo "tag=$TAG" >> $GITHUB_OUTPUT
# Explicit build step after versioning/tagging
- name: ⚙️ Build distributions
if: steps.versioning.outputs.tag != '' # Only build if a new tag was created
run: uv build --sdist --wheel
# Use the standard PyPI publish action
- name: 🚀 Publish package to PyPI
if: steps.versioning.outputs.tag != '' && inputs.pypi_publish == 'true' # Check if tag was created and publish enabled
uses: pypa/gh-action-pypi-publish@release/v1
with:
# user: __token__ # Recommended for PyPI token
password: ${{ steps.secrets.outputs.PYPI_API_TOKEN }}
skip_existing: true # Don't fail if version already exists
# Use GitHub CLI to upload assets to the release created by semantic-release version
- name: 📦 Upload assets to GitHub Release
if: steps.versioning.outputs.tag != '' # Check if tag was created
env:
GH_TOKEN: ${{ steps.secrets.outputs.TOKEN }}
run: |
gh release upload ${{ steps.versioning.outputs.tag }} dist/* --clobber
- name: ⛙ Rebase Dev Branch from Main
continue-on-error: true
run: |
git fetch origin
git checkout dev
git rebase origin/main
git push origin dev --force
env:
GITHUB_TOKEN: ${{ steps.secrets.outputs.TOKEN }}