Skip to content

Commit d9c04a6

Browse files
authored
Merge pull request #251 from yokowu/feat-ci-sgp
feat: sgp 多架构下载
2 parents e9bb1a9 + 50471cd commit d9c04a6

File tree

1 file changed

+22
-58
lines changed

1 file changed

+22
-58
lines changed

.github/workflows/backend-ci-cd.yml

Lines changed: 22 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -62,54 +62,8 @@ jobs:
6262
exit 1
6363
fi
6464
65-
prepare-assets:
66-
needs: test
67-
runs-on: ubuntu-latest
68-
if: github.event_name != 'pull_request'
69-
strategy:
70-
matrix:
71-
arch: [x86_64, aarch64]
72-
defaults:
73-
run:
74-
working-directory: ./backend
75-
steps:
76-
- name: Checkout code
77-
uses: actions/checkout@v4
78-
with:
79-
lfs: true
80-
submodules: true
81-
token: ${{ secrets.PRO_TOKEN }}
82-
83-
- name: Get version
84-
id: get_version
85-
run: |
86-
VERSION=${GITHUB_REF#refs/tags/}
87-
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
88-
89-
- name: Get VSIX
90-
run: |
91-
mkdir -p assets/vsix
92-
VERSION_NO_V=${{ steps.get_version.outputs.VERSION }}
93-
VERSION_NO_V=${VERSION_NO_V#v}
94-
wget -O assets/vsix/monkeycode-${VERSION_NO_V}.vsix https://release.baizhi.cloud/monkeycode/vsixs/monkeycode-${VERSION_NO_V}.vsix
95-
96-
- name: Get SGP for ${{ matrix.arch }}
97-
run: |
98-
mkdir -p assets/sgp
99-
echo "Downloading SGP for architecture: ${{ matrix.arch }}"
100-
wget -O assets/sgp/sgp https://baizhiyun.oss-cn-hangzhou.aliyuncs.com/prod/sgp/${{ matrix.arch }}/sgp
101-
wget -O assets/sgp/sgp-rules https://baizhiyun.oss-cn-hangzhou.aliyuncs.com/prod/sgp/${{ matrix.arch }}/sgp-rules
102-
chmod +x assets/sgp/sgp
103-
104-
- name: Upload assets for ${{ matrix.arch }}
105-
uses: actions/upload-artifact@v4
106-
with:
107-
name: assets-${{ matrix.arch }}
108-
path: backend/assets/
109-
retention-days: 1
110-
11165
build:
112-
needs: prepare-assets
66+
needs: test
11367
runs-on: ubuntu-latest
11468
if: github.event_name != 'pull_request'
11569
defaults:
@@ -151,17 +105,27 @@ jobs:
151105
GIT_COMMIT=$(git rev-parse HEAD)
152106
echo "GIT_COMMIT=${GIT_COMMIT}" >> $GITHUB_OUTPUT
153107
154-
- name: Download x86_64 assets
155-
uses: actions/download-artifact@v4
156-
with:
157-
name: assets-x86_64
158-
path: backend/assets-x86_64/
159-
160-
- name: Download aarch64 assets
161-
uses: actions/download-artifact@v4
162-
with:
163-
name: assets-aarch64
164-
path: backend/assets-aarch64/
108+
- name: Prepare assets for all architectures
109+
run: |
110+
# 创建架构特定的目录
111+
mkdir -p assets-x86_64/{vsix,sgp}
112+
mkdir -p assets-aarch64/{vsix,sgp}
113+
114+
# 下载 VSIX (架构无关)
115+
VERSION_NO_V=${{ steps.get_version.outputs.VERSION }}
116+
VERSION_NO_V=${VERSION_NO_V#v}
117+
wget -O assets-x86_64/vsix/monkeycode-${VERSION_NO_V}.vsix https://release.baizhi.cloud/monkeycode/vsixs/monkeycode-${VERSION_NO_V}.vsix
118+
cp assets-x86_64/vsix/monkeycode-${VERSION_NO_V}.vsix assets-aarch64/vsix/
119+
120+
# 下载 x86_64 SGP
121+
wget -O assets-x86_64/sgp/sgp https://baizhiyun.oss-cn-hangzhou.aliyuncs.com/prod/sgp/x86_64/sgp
122+
wget -O assets-x86_64/sgp/sgp-rules https://baizhiyun.oss-cn-hangzhou.aliyuncs.com/prod/sgp/x86_64/sgp-rules
123+
chmod +x assets-x86_64/sgp/sgp
124+
125+
# 下载 aarch64 SGP
126+
wget -O assets-arm64/sgp/sgp https://baizhiyun.oss-cn-hangzhou.aliyuncs.com/prod/sgp/aarch64/sgp
127+
wget -O assets-arm64/sgp/sgp-rules https://baizhiyun.oss-cn-hangzhou.aliyuncs.com/prod/sgp/aarch64/sgp-rules
128+
chmod +x assets-arm64/sgp/sgp
165129
166130
- name: Set up QEMU
167131
uses: docker/setup-qemu-action@v3

0 commit comments

Comments
 (0)