Skip to content

Commit d1dbe76

Browse files
committed
ci(release): 优化依赖项缓存和构建流程
1 parent eb40110 commit d1dbe76

3 files changed

Lines changed: 47 additions & 54 deletions

File tree

.github/workflows/release.yml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -143,36 +143,34 @@ jobs:
143143
id: dep-versions
144144
shell: bash
145145
run: |
146-
SM_SHA=$(git ls-remote https://github.com/AQBot-Desktop/stream-monaco.git refs/heads/main | cut -f1)
147-
MS_SHA=$(git ls-remote https://github.com/AQBot-Desktop/markstream-vue.git refs/heads/aqbot-custom | cut -f1)
148-
echo "cache-key=linked-deps-${SM_SHA:0:12}-${MS_SHA:0:12}" >> $GITHUB_OUTPUT
146+
SM_SHA=$(git -C libs/stream-monaco rev-parse HEAD)
147+
MS_SHA=$(git -C libs/markstream-vue rev-parse HEAD)
148+
echo "cache-key=${{ runner.os }}-${{ matrix.target }}-linked-deps-${SM_SHA:0:12}-${MS_SHA:0:12}" >> $GITHUB_OUTPUT
149149
150150
- name: Cache linked dependencies
151151
id: cache-linked-deps
152152
uses: actions/cache@v4
153153
with:
154154
path: |
155-
../stream-monaco
156-
../markstream-vue
155+
libs/stream-monaco/node_modules
156+
libs/stream-monaco/dist
157+
libs/markstream-vue/node_modules
158+
libs/markstream-vue/packages/markdown-parser/node_modules
159+
libs/markstream-vue/packages/markdown-parser/dist
160+
libs/markstream-vue/packages/markstream-react/node_modules
161+
libs/markstream-vue/packages/markstream-react/dist
157162
key: ${{ steps.dep-versions.outputs.cache-key }}
158163

159164
- name: Build linked dependencies
160165
if: steps.cache-linked-deps.outputs.cache-hit != 'true'
161166
shell: bash
162167
run: |
163-
cd ..
164-
165-
git clone --depth 1 https://github.com/AQBot-Desktop/stream-monaco.git stream-monaco
166-
cd stream-monaco && pnpm install --frozen-lockfile && pnpm build
167-
rm -rf .git
168-
cd ..
168+
pnpm --dir libs/stream-monaco install --frozen-lockfile
169+
pnpm --dir libs/stream-monaco build
169170
170-
git clone --depth 1 -b aqbot-custom https://github.com/AQBot-Desktop/markstream-vue.git markstream-vue
171-
cd markstream-vue && pnpm install --frozen-lockfile
172-
pnpm run build:parser
173-
cd packages/markstream-react && pnpm build && cd ../..
174-
rm -rf .git playground*/node_modules
175-
cd ..
171+
pnpm --dir libs/markstream-vue install --frozen-lockfile
172+
pnpm --dir libs/markstream-vue run build:parser
173+
pnpm --dir libs/markstream-vue/packages/markstream-react build
176174
177175
- name: Install frontend dependencies
178176
run: pnpm install --frozen-lockfile
@@ -370,4 +368,3 @@ jobs:
370368
workflow_id: 'deploy-website.yml',
371369
ref: 'main',
372370
});
373-

.github/workflows/test-build.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,35 +52,33 @@ jobs:
5252
- name: Get linked dependency versions
5353
id: dep-versions
5454
run: |
55-
SM_SHA=$(git ls-remote https://github.com/AQBot-Desktop/stream-monaco.git refs/heads/main | cut -f1)
56-
MS_SHA=$(git ls-remote https://github.com/AQBot-Desktop/markstream-vue.git refs/heads/aqbot-custom | cut -f1)
57-
echo "cache-key=linked-deps-${SM_SHA:0:12}-${MS_SHA:0:12}" >> $GITHUB_OUTPUT
55+
SM_SHA=$(git -C libs/stream-monaco rev-parse HEAD)
56+
MS_SHA=$(git -C libs/markstream-vue rev-parse HEAD)
57+
echo "cache-key=${{ runner.os }}-aarch64-apple-darwin-linked-deps-${SM_SHA:0:12}-${MS_SHA:0:12}" >> $GITHUB_OUTPUT
5858
5959
- name: Cache linked dependencies
6060
id: cache-linked-deps
6161
uses: actions/cache@v4
6262
with:
6363
path: |
64-
../stream-monaco
65-
../markstream-vue
64+
libs/stream-monaco/node_modules
65+
libs/stream-monaco/dist
66+
libs/markstream-vue/node_modules
67+
libs/markstream-vue/packages/markdown-parser/node_modules
68+
libs/markstream-vue/packages/markdown-parser/dist
69+
libs/markstream-vue/packages/markstream-react/node_modules
70+
libs/markstream-vue/packages/markstream-react/dist
6671
key: ${{ steps.dep-versions.outputs.cache-key }}
6772

6873
- name: Build linked dependencies
6974
if: steps.cache-linked-deps.outputs.cache-hit != 'true'
7075
run: |
71-
cd ..
72-
73-
git clone --depth 1 https://github.com/AQBot-Desktop/stream-monaco.git stream-monaco
74-
cd stream-monaco && pnpm install --frozen-lockfile && pnpm build
75-
rm -rf .git
76-
cd ..
77-
78-
git clone --depth 1 -b aqbot-custom https://github.com/AQBot-Desktop/markstream-vue.git markstream-vue
79-
cd markstream-vue && pnpm install --frozen-lockfile
80-
pnpm run build:parser
81-
cd packages/markstream-react && pnpm build && cd ../..
82-
rm -rf .git playground*/node_modules
83-
cd ..
76+
pnpm --dir libs/stream-monaco install --frozen-lockfile
77+
pnpm --dir libs/stream-monaco build
78+
79+
pnpm --dir libs/markstream-vue install --frozen-lockfile
80+
pnpm --dir libs/markstream-vue run build:parser
81+
pnpm --dir libs/markstream-vue/packages/markstream-react build
8482
8583
- name: Install frontend dependencies
8684
run: pnpm install --frozen-lockfile

.github/workflows/test-windows-build.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,36 +54,34 @@ jobs:
5454
id: dep-versions
5555
shell: bash
5656
run: |
57-
SM_SHA=$(git ls-remote https://github.com/AQBot-Desktop/stream-monaco.git refs/heads/main | cut -f1)
58-
MS_SHA=$(git ls-remote https://github.com/AQBot-Desktop/markstream-vue.git refs/heads/aqbot-custom | cut -f1)
59-
echo "cache-key=linked-deps-${SM_SHA:0:12}-${MS_SHA:0:12}" >> $GITHUB_OUTPUT
57+
SM_SHA=$(git -C libs/stream-monaco rev-parse HEAD)
58+
MS_SHA=$(git -C libs/markstream-vue rev-parse HEAD)
59+
echo "cache-key=${{ runner.os }}-x86_64-pc-windows-msvc-linked-deps-${SM_SHA:0:12}-${MS_SHA:0:12}" >> $GITHUB_OUTPUT
6060
6161
- name: Cache linked dependencies
6262
id: cache-linked-deps
6363
uses: actions/cache@v4
6464
with:
6565
path: |
66-
../stream-monaco
67-
../markstream-vue
66+
libs/stream-monaco/node_modules
67+
libs/stream-monaco/dist
68+
libs/markstream-vue/node_modules
69+
libs/markstream-vue/packages/markdown-parser/node_modules
70+
libs/markstream-vue/packages/markdown-parser/dist
71+
libs/markstream-vue/packages/markstream-react/node_modules
72+
libs/markstream-vue/packages/markstream-react/dist
6873
key: ${{ steps.dep-versions.outputs.cache-key }}
6974

7075
- name: Build linked dependencies
7176
if: steps.cache-linked-deps.outputs.cache-hit != 'true'
7277
shell: bash
7378
run: |
74-
cd ..
75-
76-
git clone --depth 1 https://github.com/AQBot-Desktop/stream-monaco.git stream-monaco
77-
cd stream-monaco && pnpm install --frozen-lockfile && pnpm build
78-
rm -rf .git
79-
cd ..
80-
81-
git clone --depth 1 -b aqbot-custom https://github.com/AQBot-Desktop/markstream-vue.git markstream-vue
82-
cd markstream-vue && pnpm install --frozen-lockfile
83-
pnpm run build:parser
84-
cd packages/markstream-react && pnpm build && cd ../..
85-
rm -rf .git playground*/node_modules
86-
cd ..
79+
pnpm --dir libs/stream-monaco install --frozen-lockfile
80+
pnpm --dir libs/stream-monaco build
81+
82+
pnpm --dir libs/markstream-vue install --frozen-lockfile
83+
pnpm --dir libs/markstream-vue run build:parser
84+
pnpm --dir libs/markstream-vue/packages/markstream-react build
8785
8886
- name: Install frontend dependencies
8987
run: pnpm install --frozen-lockfile

0 commit comments

Comments
 (0)