Skip to content

Commit f677ffa

Browse files
authored
perf(cd): create release directly in build-fast job (#124)
Move release creation into build-fast job to avoid slow artifact download on self-hosted runner (14MB took 16min due to network to Azure blob storage). - Remove separate create-release-fast job - Create release directly after build using local release/ directory - Keep create-release-standard for GitHub-hosted runner (artifact download is fast)
1 parent a6c0245 commit f677ffa

File tree

1 file changed

+28
-46
lines changed

1 file changed

+28
-46
lines changed

.github/workflows/cd.yml

Lines changed: 28 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,34 @@ jobs:
175175
with:
176176
path: gh-pages
177177

178-
- name: Upload release artifacts
179-
uses: actions/upload-artifact@v4
178+
# 直接在 build job 中创建 release,避免跨 job 传递 artifact(self-hosted 下载很慢)
179+
- name: Create or Update Release
180+
uses: softprops/action-gh-release@v2
180181
with:
181-
name: release-${{ steps.channel.outputs.channel }}-${{ steps.version.outputs.version }}
182-
path: release/
183-
retention-days: 30
182+
tag_name: ${{ steps.channel.outputs.channel == 'stable' && format('v{0}', steps.version.outputs.version) || 'beta' }}
183+
name: ${{ steps.channel.outputs.channel == 'stable' && format('BFM Pay v{0}', steps.version.outputs.version) || 'BFM Pay Beta' }}
184+
body: |
185+
## BFM Pay ${{ steps.channel.outputs.channel == 'stable' && format('v{0}', steps.version.outputs.version) || 'Beta' }}
186+
187+
### 下载
188+
- **Web 版本**: `bfmpay-web${{ steps.channel.outputs.channel == 'beta' && '-beta' || '' }}.zip`
189+
- **DWEB 版本**: `bfmpay-dweb${{ steps.channel.outputs.channel == 'beta' && '-beta' || '' }}.zip`
190+
191+
### 在线访问
192+
- Web 应用 (stable): https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/webapp/
193+
- Web 应用 (beta): https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/webapp-beta/
194+
- 文档首页: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/
195+
196+
### DWEB 安装
197+
在 DWEB 浏览器中打开以下链接安装:
198+
```
199+
dweb://install?url=https://github.com/${{ github.repository }}/releases/download/${{ steps.channel.outputs.channel == 'stable' && format('v{0}', steps.version.outputs.version) || 'beta' }}/bfmpay-dweb${{ steps.channel.outputs.channel == 'beta' && '-beta' || '' }}.zip
200+
```
201+
files: |
202+
release/*
203+
draft: false
204+
prerelease: ${{ steps.channel.outputs.channel == 'beta' }}
205+
generate_release_notes: ${{ steps.channel.outputs.channel == 'stable' }}
184206

185207
# ==================== GitHub-hosted 标准构建 ====================
186208
build-standard:
@@ -427,47 +449,7 @@ jobs:
427449
id: deployment
428450
uses: actions/deploy-pages@v4
429451

430-
# ==================== 创建 Release ====================
431-
create-release-fast:
432-
if: vars.USE_SELF_HOSTED == 'true'
433-
needs: build-fast
434-
runs-on: self-hosted
435-
436-
steps:
437-
- name: Download release artifacts
438-
uses: actions/download-artifact@v4
439-
with:
440-
name: release-${{ needs.build-fast.outputs.channel }}-${{ needs.build-fast.outputs.version }}
441-
path: release/
442-
443-
- name: Create or Update Release
444-
uses: softprops/action-gh-release@v2
445-
with:
446-
tag_name: ${{ needs.build-fast.outputs.channel == 'stable' && format('v{0}', needs.build-fast.outputs.version) || 'beta' }}
447-
name: ${{ needs.build-fast.outputs.channel == 'stable' && format('BFM Pay v{0}', needs.build-fast.outputs.version) || 'BFM Pay Beta' }}
448-
body: |
449-
## BFM Pay ${{ needs.build-fast.outputs.channel == 'stable' && format('v{0}', needs.build-fast.outputs.version) || 'Beta' }}
450-
451-
### 下载
452-
- **Web 版本**: `bfmpay-web${{ needs.build-fast.outputs.channel == 'beta' && '-beta' || '' }}.zip`
453-
- **DWEB 版本**: `bfmpay-dweb${{ needs.build-fast.outputs.channel == 'beta' && '-beta' || '' }}.zip`
454-
455-
### 在线访问
456-
- Web 应用 (stable): https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/webapp/
457-
- Web 应用 (beta): https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/webapp-beta/
458-
- 文档首页: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/
459-
460-
### DWEB 安装
461-
在 DWEB 浏览器中打开以下链接安装:
462-
```
463-
dweb://install?url=https://github.com/${{ github.repository }}/releases/download/${{ needs.build-fast.outputs.channel == 'stable' && format('v{0}', needs.build-fast.outputs.version) || 'beta' }}/bfmpay-dweb${{ needs.build-fast.outputs.channel == 'beta' && '-beta' || '' }}.zip
464-
```
465-
files: |
466-
release/*
467-
draft: false
468-
prerelease: ${{ needs.build-fast.outputs.channel == 'beta' }}
469-
generate_release_notes: ${{ needs.build-fast.outputs.channel == 'stable' }}
470-
452+
# ==================== 创建 Release (GitHub-hosted) ====================
471453
create-release-standard:
472454
if: vars.USE_SELF_HOSTED != 'true'
473455
needs: build-standard

0 commit comments

Comments
 (0)