Repository navigation
64 lines (53 loc) · 1.63 KB
/
Copy pathrelease.yml
File metadata and controls
64 lines (53 loc) · 1.63 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
name: Release
# Publishes to PyPI through Trusted Publishing (OIDC) — no API token is stored.
# Runs on version tags, or by hand from the Actions tab for the current main.
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: build sdist and wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
- name: Tag matches pyproject version
if: startsWith(github.ref, 'refs/tags/v')
run: |
tag="${GITHUB_REF_NAME#v}"
version="$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"])')"
if [ "$tag" != "$version" ]; then
echo "tag v$tag does not match pyproject version $version"; exit 1
fi
- name: Build
run: uv build
- name: Wheel installs and runs
run: |
uv venv /tmp/smoke
uv pip install --python /tmp/smoke/bin/python dist/*.whl
/tmp/smoke/bin/openmuse version
/tmp/smoke/bin/openmuse config init --path /tmp/smoke/config.toml
test -f /tmp/smoke/config.toml
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
if-no-files-found: error
publish:
name: publish to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/openmuse/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1