Skip to content

Commit d5543f9

Browse files
authored
Merge pull request #15 from AgentWorkforce/binary-install
publish binary
2 parents 2604921 + eb34d2f commit d5543f9

1 file changed

Lines changed: 142 additions & 7 deletions

File tree

.github/workflows/publish.yml

Lines changed: 142 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ concurrency:
3939
permissions:
4040
contents: write
4141
id-token: write
42+
packages: write
4243

4344
env:
4445
NPM_CONFIG_FUND: false
@@ -181,9 +182,95 @@ jobs:
181182
env:
182183
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
183184

185+
# Build standalone binaries using bun compile
186+
build-standalone:
187+
name: Build standalone (${{ matrix.target }})
188+
runs-on: ${{ matrix.os }}
189+
needs: build
190+
if: github.event.inputs.dry_run != 'true'
191+
strategy:
192+
fail-fast: false
193+
matrix:
194+
include:
195+
- os: macos-latest
196+
target: bun-darwin-arm64
197+
binary_name: relay-dashboard-server-darwin-arm64
198+
- os: macos-latest
199+
target: bun-darwin-x64
200+
binary_name: relay-dashboard-server-darwin-x64
201+
- os: ubuntu-latest
202+
target: bun-linux-x64
203+
binary_name: relay-dashboard-server-linux-x64
204+
- os: ubuntu-latest
205+
target: bun-linux-arm64
206+
binary_name: relay-dashboard-server-linux-arm64
207+
208+
steps:
209+
- name: Checkout code
210+
uses: actions/checkout@v4
211+
212+
- name: Setup Bun
213+
uses: oven-sh/setup-bun@v2
214+
with:
215+
bun-version: latest
216+
217+
- name: Setup Node.js
218+
uses: actions/setup-node@v4
219+
with:
220+
node-version: "22"
221+
cache: "npm"
222+
223+
- name: Download build artifacts
224+
uses: actions/download-artifact@v4
225+
with:
226+
name: build-output
227+
path: .
228+
229+
- name: Install dependencies
230+
run: npm ci
231+
232+
- name: Build standalone binary
233+
run: |
234+
mkdir -p release-binaries
235+
236+
# The dashboard-server entry point is dist/start.js
237+
bun build \
238+
--compile \
239+
--minify \
240+
--target=${{ matrix.target }} \
241+
--define="process.env.DASHBOARD_SERVER_VERSION=\"${{ needs.build.outputs.new_version }}\"" \
242+
./packages/dashboard-server/dist/start.js \
243+
--outfile release-binaries/${{ matrix.binary_name }}
244+
245+
- name: Verify binary
246+
if: matrix.target == 'bun-linux-x64' || (matrix.target == 'bun-darwin-arm64' && runner.arch == 'ARM64')
247+
run: |
248+
chmod +x release-binaries/${{ matrix.binary_name }}
249+
./release-binaries/${{ matrix.binary_name }} --version || echo "Binary created (cross-compiled)"
250+
251+
- name: Compress binary with gzip
252+
run: |
253+
gzip -9 -k release-binaries/${{ matrix.binary_name }}
254+
echo "Uncompressed: $(du -h release-binaries/${{ matrix.binary_name }} | cut -f1)"
255+
echo "Compressed: $(du -h release-binaries/${{ matrix.binary_name }}.gz | cut -f1)"
256+
257+
- name: Upload compressed binary
258+
uses: actions/upload-artifact@v4
259+
with:
260+
name: ${{ matrix.binary_name }}.gz
261+
path: release-binaries/${{ matrix.binary_name }}.gz
262+
retention-days: 1
263+
264+
- name: Upload uncompressed binary
265+
uses: actions/upload-artifact@v4
266+
with:
267+
name: ${{ matrix.binary_name }}
268+
path: release-binaries/${{ matrix.binary_name }}
269+
retention-days: 1
270+
184271
create-release:
185272
name: Create Release
186-
needs: [build, publish]
273+
needs: [build, publish, build-standalone]
187274
runs-on: ubuntu-latest
188275
if: github.event.inputs.dry_run != 'true'
189276

@@ -199,6 +286,19 @@ jobs:
199286
name: build-output
200287
path: .
201288

289+
- name: Download standalone binaries
290+
uses: actions/download-artifact@v4
291+
with:
292+
path: artifacts
293+
pattern: relay-dashboard-server-*
294+
295+
- name: Prepare release assets
296+
run: |
297+
mkdir -p release-assets
298+
# Move all binaries to release-assets
299+
find artifacts -type f \( -name "relay-dashboard-server-*" \) -exec mv {} release-assets/ \;
300+
ls -la release-assets/
301+
202302
- name: Commit and tag
203303
run: |
204304
git config user.name "GitHub Actions"
@@ -216,25 +316,55 @@ jobs:
216316
git push origin "v${NEW_VERSION}"
217317
218318
- name: Create GitHub Release
219-
uses: softprops/action-gh-release@v1
319+
uses: softprops/action-gh-release@v2
220320
with:
221321
tag_name: v${{ needs.build.outputs.new_version }}
222322
name: v${{ needs.build.outputs.new_version }}
223323
body: |
224324
## @agent-relay/dashboard v${{ needs.build.outputs.new_version }}
225325
226326
### Installation
327+
328+
**Via npm:**
329+
```bash
330+
npm install -g @agent-relay/dashboard-server@${{ needs.build.outputs.new_version }}
331+
```
332+
333+
**Via standalone binary (no Node.js required):**
227334
```bash
228-
npm install @agent-relay/dashboard@${{ needs.build.outputs.new_version }}
229-
npm install @agent-relay/dashboard-server@${{ needs.build.outputs.new_version }}
335+
# macOS (Apple Silicon)
336+
curl -fsSL https://github.com/AgentWorkforce/relay-dashboard/releases/download/v${{ needs.build.outputs.new_version }}/relay-dashboard-server-darwin-arm64.gz | gunzip > relay-dashboard-server
337+
chmod +x relay-dashboard-server
338+
339+
# macOS (Intel)
340+
curl -fsSL https://github.com/AgentWorkforce/relay-dashboard/releases/download/v${{ needs.build.outputs.new_version }}/relay-dashboard-server-darwin-x64.gz | gunzip > relay-dashboard-server
341+
chmod +x relay-dashboard-server
342+
343+
# Linux (x64)
344+
curl -fsSL https://github.com/AgentWorkforce/relay-dashboard/releases/download/v${{ needs.build.outputs.new_version }}/relay-dashboard-server-linux-x64.gz | gunzip > relay-dashboard-server
345+
chmod +x relay-dashboard-server
346+
347+
# Linux (ARM64)
348+
curl -fsSL https://github.com/AgentWorkforce/relay-dashboard/releases/download/v${{ needs.build.outputs.new_version }}/relay-dashboard-server-linux-arm64.gz | gunzip > relay-dashboard-server
349+
chmod +x relay-dashboard-server
230350
```
351+
352+
### Assets
353+
354+
| Platform | Compressed | Uncompressed |
355+
|----------|------------|--------------|
356+
| macOS (Apple Silicon) | relay-dashboard-server-darwin-arm64.gz | relay-dashboard-server-darwin-arm64 |
357+
| macOS (Intel) | relay-dashboard-server-darwin-x64.gz | relay-dashboard-server-darwin-x64 |
358+
| Linux (x64) | relay-dashboard-server-linux-x64.gz | relay-dashboard-server-linux-x64 |
359+
| Linux (ARM64) | relay-dashboard-server-linux-arm64.gz | relay-dashboard-server-linux-arm64 |
360+
files: release-assets/*
231361
generate_release_notes: true
232362
env:
233363
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
234364

235365
summary:
236366
name: Summary
237-
needs: [build, publish]
367+
needs: [build, publish, build-standalone, create-release]
238368
runs-on: ubuntu-latest
239369
if: always()
240370

@@ -248,5 +378,10 @@ jobs:
248378
echo "**Dry Run**: \`${{ github.event.inputs.dry_run }}\`" >> $GITHUB_STEP_SUMMARY
249379
echo "" >> $GITHUB_STEP_SUMMARY
250380
echo "### Results" >> $GITHUB_STEP_SUMMARY
251-
echo "- Build: ${{ needs.build.result }}" >> $GITHUB_STEP_SUMMARY
252-
echo "- Publish: ${{ needs.publish.result }}" >> $GITHUB_STEP_SUMMARY
381+
echo "" >> $GITHUB_STEP_SUMMARY
382+
echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY
383+
echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY
384+
echo "| Build | ${{ needs.build.result == 'success' && '✅' || '❌' }} ${{ needs.build.result }} |" >> $GITHUB_STEP_SUMMARY
385+
echo "| Publish | ${{ needs.publish.result == 'success' && '✅' || '❌' }} ${{ needs.publish.result }} |" >> $GITHUB_STEP_SUMMARY
386+
echo "| Build Standalone | ${{ needs.build-standalone.result == 'success' && '✅' || (needs.build-standalone.result == 'skipped' && '⏭️' || '❌') }} ${{ needs.build-standalone.result }} |" >> $GITHUB_STEP_SUMMARY
387+
echo "| Create Release | ${{ needs.create-release.result == 'success' && '✅' || (needs.create-release.result == 'skipped' && '⏭️' || '❌') }} ${{ needs.create-release.result }} |" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)