-
Notifications
You must be signed in to change notification settings - Fork 7
88 lines (76 loc) · 2.51 KB
/
Copy pathrolling-packages.yml
File metadata and controls
88 lines (76 loc) · 2.51 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
# Copyright (c) 2026 Cisco Systems, Inc. and its affiliates
# SPDX-License-Identifier: Apache-2.0
name: Rolling Packages
on:
push:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: rolling-packages-${{ github.ref }}
cancel-in-progress: true
jobs:
build-rolling:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: runtime
path: runtime
pyproject: runtime/pyproject.toml
- name: library
path: library-standard
pyproject: library-standard/pyproject.toml
- name: ctl
path: ctl
pyproject: ctl/pyproject.toml
- name: core
path: lab/components/core
pyproject: lab/components/core/pyproject.toml
- name: bench
path: lab/components/bench
pyproject: lab/components/bench/pyproject.toml
- name: lab
path: lab
pyproject: lab/pyproject.toml
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Setup Python
run: uv python install 3.12
- name: Install build tools
run: uv tool install build
- name: Compute rolling version
id: rolling
run: |
BASE=$(python3 scripts/version_manager.py get ${{ matrix.name }})
SHORT_SHA=$(git rev-parse --short=7 HEAD)
ROLLING="${BASE}+g${SHORT_SHA}"
echo "base=${BASE}" >> "$GITHUB_OUTPUT"
echo "sha=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
echo "rolling=${ROLLING}" >> "$GITHUB_OUTPUT"
echo "Rolling version: ${ROLLING}"
- name: Patch package version for rolling build
run: |
python3 - <<'PY'
from pathlib import Path
import re
path = Path("${{ matrix.pyproject }}")
content = path.read_text()
rolling = "${{ steps.rolling.outputs.rolling }}"
updated = re.sub(r'version\s*=\s*"[^"]+"', f'version = "{rolling}"', content, count=1)
path.write_text(updated)
print(f"Patched {path} -> {rolling}")
PY
- name: Build rolling package
run: pyproject-build ${{ matrix.path }}
- name: Upload rolling artifacts
uses: actions/upload-artifact@v4
with:
name: rolling-${{ matrix.name }}-${{ steps.rolling.outputs.sha }}
path: ${{ matrix.path }}/dist/*
retention-days: 14