File tree Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Expand file tree Collapse file tree 1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change 35
35
36
36
## 實作步驟
37
37
38
+ ### 發佈套件到 GitLab Package Registry
39
+
40
+ 在設定和使用私有 Registry 之前,我們需要先將套件上傳到 GitLab Package Registry。
41
+
42
+ #### 使用 twine 上傳套件
43
+
44
+ twine 是 Python 官方推薦的套件上傳工具,會自動從 wheel 檔案中提取 metadata:
45
+
46
+ ``` bash
47
+ # 安裝 twine
48
+ pip install twine
49
+
50
+ # 上傳到 GitLab PyPI registry
51
+ twine upload --repository-url https://gitlab.com/api/v4/projects/{PROJECT_ID}/packages/pypi \
52
+ --username gitlab+deploy-token-{TOKEN_ID} \
53
+ --password {TOKEN} \
54
+ your_package.whl
55
+ ```
56
+
57
+ 實際範例(以 ONNX Runtime 為例):
58
+
59
+ ``` bash
60
+ twine upload --repository-url https://gitlab.com/api/v4/projects/70410750/packages/pypi \
61
+ --username gitlab+deploy-token-9097451 \
62
+ --password gldt-tQVwLxzydZBhn3WWnwtt \
63
+ onnxruntime_gpu-1.23.0-cp310-cp310-linux_aarch64.whl
64
+ ```
65
+
38
66
### 設定 GitLab Package Registry
39
67
40
68
首先,在 GitLab 專案中啟用 Package Registry,並建立 Deploy Token:
@@ -96,7 +124,7 @@ dependencies = [
96
124
97
125
這裡的關鍵是使用條件依賴,根據不同平台安裝不同版本的套件。
98
126
99
- ### 3. 開發者使用私有 Registry
127
+ ### 開發者使用私有 Registry
100
128
101
129
根據專案的安全策略,RD 有幾種方式存取私有 registry:
102
130
148
176
uv sync
149
177
```
150
178
151
- ### 4. CI/CD 中存取私有 Registry
179
+ ### CI/CD 中存取私有 Registry
152
180
153
181
專案在 GitLab CI/CD 中需要存取私有 Registry 時,有以下幾種方式:
154
182
You can’t perform that action at this time.
0 commit comments