Repository navigation
140 lines (123 loc) · 4.79 KB
/
Copy pathrelease.yml
File metadata and controls
140 lines (123 loc) · 4.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Release Executa Binary
on:
workflow_dispatch:
inputs:
version:
description: "Release version (e.g. 1.0.0)"
required: true
default: "1.0.0"
push:
tags:
- "v*"
permissions:
contents: write
jobs:
# ─────────────────────────────────────────────
# 构建三平台 Executa 二进制
# ─────────────────────────────────────────────
build:
name: Build (${{ matrix.platform }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- platform: darwin-arm64
runner: macos-latest
archive_ext: .tar.gz
- platform: darwin-x86_64
runner: macos-13
archive_ext: .tar.gz
- platform: windows-x86_64
runner: windows-latest
archive_ext: .zip
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: "9"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build TypeScript (Executa)
run: pnpm --filter tool-dev-mini-notes build
- name: Bundle + Package Binary
working-directory: executas/tool-dev-mini-notes
run: node scripts/bundle.mjs --archive
- name: Smoke test (describe)
working-directory: executas/tool-dev-mini-notes
shell: bash
run: |
BUNDLE="sea/bundle.cjs"
REQUEST='{"jsonrpc":"2.0","id":1,"method":"describe"}'
RESPONSE=$(echo "$REQUEST" | timeout 5 node "$BUNDLE" 2>/dev/null | tail -1)
echo "Response: $RESPONSE"
NAME=$(echo "$RESPONSE" | node -e "process.stdout.write(JSON.parse(require('fs').readFileSync('/dev/stdin','utf8')).result.name)")
if [ "$NAME" != "tool-dev-mini-notes" ]; then
echo "FAIL: expected tool-dev-mini-notes, got $NAME"
exit 1
fi
echo "✓ Smoke test passed"
- name: Upload archive artifact
uses: actions/upload-artifact@v4
with:
name: executa-${{ matrix.platform }}
path: executas/tool-dev-mini-notes/sea/tool-dev-mini-notes-${{ matrix.platform }}${{ matrix.archive_ext }}
if-no-files-found: error
# ─────────────────────────────────────────────
# 发布到 GitHub Release
# ─────────────────────────────────────────────
release:
name: Create Release
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: executa-*
merge-multiple: true
path: release-assets
- name: List assets
run: ls -lh release-assets/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: "Release ${{ github.ref_name }}"
files: release-assets/*
generate_release_notes: true
fail_on_unmatched_files: true
# ─────────────────────────────────────────────
# workflow_dispatch 时只构建 artifacts(不发布 Release)
# ─────────────────────────────────────────────
summary:
name: Summary
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'workflow_dispatch'
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: executa-*
merge-multiple: true
path: release-assets
- name: Show summary
run: |
echo "### ✅ Build Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Platform | Asset |" >> $GITHUB_STEP_SUMMARY
echo "|---|---|" >> $GITHUB_STEP_SUMMARY
for f in release-assets/*; do
PLAT=$(echo "$(basename "$f")" | sed 's/tool-dev-mini-notes-//' | sed 's/\.tar\.gz//' | sed 's/\.zip//')
SIZE=$(du -h "$f" | cut -f1)
echo "| $PLAT | $(basename "$f") ($SIZE) |" >> $GITHUB_STEP_SUMMARY
done
echo "" >> $GITHUB_STEP_SUMMARY
echo "> Trigger a tag push (\`v*\`) to create a GitHub Release." >> $GITHUB_STEP_SUMMARY