Skip to content

Commit aa72ce2

Browse files
committed
Fixing GitHub Actions errors
1 parent 5c79c14 commit aa72ce2

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
description: '版本号 (如: v1.0.0)'
1313
required: true
1414
default: 'v1.0.0'
15+
dry_run:
16+
description: '仅构建与产出制品,不创建GitHub Release(默认 true)'
17+
required: false
18+
default: 'true'
1519

1620
env:
1721
REGISTRY: ghcr.io
@@ -266,7 +270,7 @@ jobs:
266270
echo "压缩包大小: $(ls -lh runpanel-embedded-${{ matrix.os }}-${{ matrix.arch }}.tar.gz | awk '{print $5}')"
267271
268272
- name: Upload artifacts
269-
uses: actions/upload-artifact@v3
273+
uses: actions/upload-artifact@v4
270274
with:
271275
name: runpanel-embedded-${{ matrix.os }}-${{ matrix.arch }}
272276
path: dist/runpanel-embedded-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
@@ -300,9 +304,11 @@ jobs:
300304
echo "VERSION=$VERSION" >> $GITHUB_ENV
301305
302306
- name: Download all artifacts
303-
uses: actions/download-artifact@v3
307+
uses: actions/download-artifact@v4
304308
with:
305309
path: artifacts/
310+
# 合并多个制品到同一目录,便于后续处理
311+
merge-multiple: true
306312

307313
- name: Prepare release files
308314
run: |
@@ -376,6 +382,10 @@ jobs:
376382
echo "EOF" >> $GITHUB_ENV
377383
378384
- name: Create Release
385+
if: |
386+
github.event_name == 'release' ||
387+
startsWith(github.ref, 'refs/tags/') ||
388+
(github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run != 'true')
379389
uses: softprops/action-gh-release@v1
380390
with:
381391
tag_name: ${{ env.VERSION }}
@@ -399,11 +409,17 @@ jobs:
399409
if: always()
400410
steps:
401411
- name: Notify success
402-
if: needs.release.result == 'success'
412+
if: needs.release.result == 'success' && !(github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true')
403413
run: |
404414
echo "✅ RunPanel ${{ needs.release.outputs.version || 'latest' }} 发布成功!"
405415
echo "📦 Release 页面: ${{ github.server_url }}/${{ github.repository }}/releases"
406416
417+
- name: Notify dry-run success
418+
if: needs.release.result == 'success' && github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run == 'true'
419+
run: |
420+
echo "🧪 Dry Run 成功:构建与制品产出完成(未创建Release)。"
421+
echo "🔍 请在该工作流运行页面下载 artifacts 并检查。"
422+
407423
- name: Notify failure
408424
if: needs.release.result == 'failure'
409425
run: |

0 commit comments

Comments
 (0)