-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (101 loc) · 3.31 KB
/
release.yml
File metadata and controls
118 lines (101 loc) · 3.31 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
110
111
112
113
114
115
116
117
118
name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "要发布的版本号,例如 1.3.0"
required: true
tag:
description: "目标标签,例如 v1.3.0"
required: true
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- runner: windows-latest
target: windows-x64
- runner: macos-15-intel
target: macos-x64
- runner: macos-15
target: macos-arm64
- runner: ubuntu-24.04
target: linux-x64
- runner: ubuntu-24.04-arm
target: linux-arm64
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
- name: Setup Python
uses: actions/setup-python@v6.2.0
with:
python-version: "3.11"
- name: Setup uv
uses: astral-sh/setup-uv@v7.6.0
- name: Sync dependencies
run: uv sync --group dev
- name: Build binary bundle
run: uv run python scripts/build_binary_release.py --target "${{ matrix.target }}" --validate
- name: Upload release artifact
uses: actions/upload-artifact@v7.0.0
with:
name: ${{ matrix.target }}
path: |
release_artifacts/*.zip
release_artifacts/*.tar.gz
if-no-files-found: error
publish:
needs: build
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v8.0.1
with:
path: release_artifacts
- name: Setup Python
uses: actions/setup-python@v6.2.0
with:
python-version: "3.11"
- name: Resolve version metadata
id: release_meta
shell: bash
run: |
if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then
echo "tag=${{ github.event.inputs.tag }}" >> "${GITHUB_OUTPUT}"
echo "version=${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}"
else
tag="${GITHUB_REF_NAME}"
version="${tag#v}"
echo "tag=${tag}" >> "${GITHUB_OUTPUT}"
echo "version=${version}" >> "${GITHUB_OUTPUT}"
fi
- name: Extract release notes
run: python scripts/extract_release_notes.py --version "${{ steps.release_meta.outputs.version }}" --output RELEASE_NOTES.md
- name: Publish GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
mapfile -t files < <(find release_artifacts -maxdepth 2 -type f \( -name "PyRAG-Kit-*.zip" -o -name "PyRAG-Kit-*.tar.gz" \) | sort)
if [ "${#files[@]}" -eq 0 ]; then
echo "未找到发布产物。" >&2
exit 1
fi
if gh release view "${{ steps.release_meta.outputs.tag }}" >/dev/null 2>&1; then
gh release upload "${{ steps.release_meta.outputs.tag }}" "${files[@]}" --clobber
else
gh release create "${{ steps.release_meta.outputs.tag }}" "${files[@]}" \
--title "${{ steps.release_meta.outputs.tag }}" \
--notes-file RELEASE_NOTES.md
fi