-
Notifications
You must be signed in to change notification settings - Fork 553
69 lines (63 loc) · 1.81 KB
/
release.yml
File metadata and controls
69 lines (63 loc) · 1.81 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
name: Release
on:
release:
types:
- published
jobs:
checks:
name: Run checks workflow
uses: ./.github/workflows/checks.yml
secrets:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
semver-parser:
name: Parse the semantic version from the release
runs-on: ubuntu-latest
steps:
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.12"
activate-environment: true
enable-cache: true
- name: Install packaging
run: uv pip install packaging
- name: Parse semver string
id: semver_parser
env:
RAW_TAG: ${{ github.event.release.tag_name }}
run: |
VERSION="${RAW_TAG#v}"
echo "Detected version: $VERSION"
echo "version=$(uv run python -c "from packaging.version import Version; print(Version('$VERSION'))")" >> $GITHUB_OUTPUT
outputs:
semver: "${{ steps.semver_parser.outputs.version }}"
release-python:
name: Release Python package to PyPi
needs:
- checks
- semver-parser
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.12"
activate-environment: true
enable-cache: true
- name: Install dependencies
run: |
uv lock --check
uv sync
- name: Set the version
run: make version-set VERSION=${{needs.semver-parser.outputs.semver}}
- name: re-sync
run: uv sync
- name: Build
run: uv build
- name: Publish
run: |
uv pip install twine
uv run twine upload --non-interactive -u __token__ -p "$PYPI_TOKEN_PYPI" dist/*
env:
PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN_PYPI }}