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 3535
3636## 實作步驟
3737
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+
3866### 設定 GitLab Package Registry
3967
4068首先,在 GitLab 專案中啟用 Package Registry,並建立 Deploy Token:
@@ -96,7 +124,7 @@ dependencies = [
96124
97125這裡的關鍵是使用條件依賴,根據不同平台安裝不同版本的套件。
98126
99- ### 3. 開發者使用私有 Registry
127+ ### 開發者使用私有 Registry
100128
101129根據專案的安全策略,RD 有幾種方式存取私有 registry:
102130
148176uv sync
149177```
150178
151- ### 4. CI/CD 中存取私有 Registry
179+ ### CI/CD 中存取私有 Registry
152180
153181專案在 GitLab CI/CD 中需要存取私有 Registry 時,有以下幾種方式:
154182
You can’t perform that action at this time.
0 commit comments