-
Notifications
You must be signed in to change notification settings - Fork 22
105 lines (90 loc) · 3.2 KB
/
Copy pathrelease.yml
File metadata and controls
105 lines (90 loc) · 3.2 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: Existing v-prefixed tag to release
required: true
type: string
permissions:
contents: read
concurrency:
group: release-${{ github.ref_name }}
cancel-in-progress: false
jobs:
release:
# Releases are built and published from the private repository only.
# The public mirror carries the same workflow file, where a tag push
# could never succeed (no release credentials); skip it there.
if: github.repository == 'So3Lab/CADIR'
name: Test, build, and release
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
contents: write
env:
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
steps:
- name: Check out tagged revision
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
ref: ${{ env.RELEASE_TAG }}
fetch-depth: 0
- name: Install uv and Python
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
with:
python-version: "3.12"
enable-cache: true
cache-python: true
- name: Validate tag and project version
shell: bash
run: |
set -euo pipefail
if [[ ! "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([ab]|rc)?[0-9]*$ ]]; then
echo "Invalid release tag: $RELEASE_TAG" >&2
exit 1
fi
project_version="$(uv run --python 3.12 --no-project python - <<'PY'
import tomllib
with open('pyproject.toml', 'rb') as file:
print(tomllib.load(file)['project']['version'])
PY
)"
if [[ "$RELEASE_TAG" != "v$project_version" ]]; then
echo "Tag $RELEASE_TAG does not match pyproject version $project_version" >&2
exit 1
fi
- name: Install locked dependencies
run: uv sync --locked --group dev
- name: Install headless rendering support
run: sudo apt-get update && sudo apt-get install --yes xvfb
- name: Compile package
run: uv run python -m compileall -q src/simplecadapi
- name: Run tests
run: xvfb-run --auto-servernum uv run pytest test tests -q
- name: Build wheel and source distribution
run: uv build
- name: Verify distributions
run: uv run twine check dist/*
- name: Build and verify Agent Skill archive
run: |
uv run python tools/auto_docs_gen.py --quiet
uv run python tools/skillbuild.py --target omp
uv run pytest test/test_skill_build.py -q
tar -C skills -czf skills/simplecadapi.tar.gz simplecadapi-omp
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
release_flags=()
if [[ "$RELEASE_TAG" =~ (a|b|rc)[0-9]+$ ]]; then
release_flags+=(--prerelease --latest=false)
fi
gh release create "$RELEASE_TAG" dist/* skills/simplecadapi.tar.gz \
--verify-tag \
--generate-notes \
--title "$RELEASE_TAG" \
"${release_flags[@]}"