-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (93 loc) · 3.57 KB
/
cd.yaml
File metadata and controls
107 lines (93 loc) · 3.57 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
name: CD
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
# Linux targets — cross-compiled from ubuntu (no ARM runner needed)
- runner: ubuntu-latest
target: bun-linux-x64
artifact: github-code-search-linux-x64
- runner: ubuntu-latest
target: bun-linux-x64-baseline
artifact: github-code-search-linux-x64-baseline
- runner: ubuntu-latest
target: bun-linux-arm64
artifact: github-code-search-linux-arm64
# Windows — cross-compiled from ubuntu
- runner: ubuntu-latest
target: bun-windows-x64
artifact: github-code-search-windows-x64.exe
- runner: ubuntu-latest
target: bun-windows-x64-baseline
artifact: github-code-search-windows-x64-baseline.exe
- runner: ubuntu-latest
target: bun-windows-x64-modern
artifact: github-code-search-windows-x64-modern.exe
- runner: ubuntu-latest
target: bun-windows-arm64
artifact: github-code-search-windows-arm64.exe
# macOS — must run on macOS for ad-hoc codesigning
- runner: macos-latest
target: bun-darwin-x64
artifact: github-code-search-macos-x64
- runner: macos-latest
target: bun-darwin-arm64
artifact: github-code-search-macos-arm64
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Bun
uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2.1.3
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run tests
run: bun test
- name: Build binary
run: bun run build.ts --target=${{ matrix.target }}
- name: Rename artifact
# build.ts outputs dist/github-code-search-<target-without-bun->
# Rename to the canonical artifact name defined in the matrix.
shell: bash
run: |
src="dist/github-code-search-$(echo '${{ matrix.target }}' | sed 's/^bun-//')"
[ -f "${src}.exe" ] && src="${src}.exe"
[ -f "dist/${{ matrix.artifact }}" ] || mv -v "$src" "dist/${{ matrix.artifact }}"
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.artifact }}
path: dist/${{ matrix.artifact }}
release:
name: Create GitHub release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v7
with:
path: dist/
merge-multiple: true
- name: Create legacy artifact aliases (backward-compat for upgrade)
# Fix: binaries built before v1.2.1 look for darwin-* / win32-* asset names.
# Publishing these aliases lets old binaries upgrade themselves — see issue #45.
run: |
cp dist/github-code-search-macos-arm64 dist/github-code-search-darwin-arm64
cp dist/github-code-search-macos-x64 dist/github-code-search-darwin-x64
cp dist/github-code-search-windows-x64.exe dist/github-code-search-win32-x64.exe
- name: Create release
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
with:
files: dist/*
generate_release_notes: true