-
Notifications
You must be signed in to change notification settings - Fork 6
168 lines (140 loc) · 4.46 KB
/
Copy pathrelease.yml
File metadata and controls
168 lines (140 loc) · 4.46 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: Build and Release CLI
on:
push:
branches:
- main
permissions:
contents: write
jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
token: ${{ github.token }}
- name: Install dependencies
run: bun install
- name: Install web-ui deps
run: bun install --cwd packages/web-ui
- name: Build web UI
run: bun run build:web
- name: Typecheck
run: bun run typecheck
- name: Test suite
run: bun test
build:
runs-on: ${{ matrix.os }}
needs: verify
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: bun-linux-x64
artifact: ode-linux-x64
- os: windows-latest
target: bun-windows-x64
artifact: ode-windows-x64.exe
- os: macos-15-intel
target: bun-darwin-x64
artifact: ode-darwin-x64
- os: macos-14
target: bun-darwin-arm64
artifact: ode-darwin-arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
token: ${{ github.token }}
- name: Install dependencies
run: bun install
- name: Install web-ui deps
run: bun install --cwd packages/web-ui
- name: Build web UI
run: bun run build:web
- name: Embed web UI assets
run: bun run embed:web
- name: Build CLI
run: bun build packages/core/cli.ts --compile --target ${{ matrix.target }} --outfile dist/${{ matrix.artifact }}
- name: Ad-hoc sign macOS binary
if: runner.os == 'macOS'
run: |
set -euo pipefail
bin="dist/${{ matrix.artifact }}"
# Bun --compile may emit a malformed LC_CODE_SIGNATURE that AMFI rejects
# and that codesign refuses to overwrite in place. Strip it first, then
# re-sign ad-hoc so macOS will actually execute the binary.
codesign --remove-signature "$bin" || true
codesign --sign - --force --timestamp=none "$bin"
codesign --verify --verbose=2 "$bin"
codesign -dv "$bin"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist/${{ matrix.artifact }}
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Generate checksums
run: |
cd dist
sha256sum ode-* > SHA256SUMS
- name: Read version
id: vars
run: |
version="$(node -p "require('./package.json').version")"
echo "version=${version}" >> "$GITHUB_OUTPUT"
- name: Build release notes
id: notes
shell: bash
run: |
set -euo pipefail
git fetch --tags --force
current_tag="v${{ steps.vars.outputs.version }}"
previous_tag="$(git tag --list 'v*' --sort=-version:refname | grep -vx "${current_tag}" | head -n 1 || true)"
if [[ -n "${previous_tag}" ]]; then
range="${previous_tag}..HEAD"
summary_line="- Changes since \`${previous_tag}\`"
else
first_commit="$(git rev-list --max-parents=0 HEAD | tail -n 1)"
range="${first_commit}..HEAD"
summary_line="- Changes from initial commit"
fi
commit_count="$(git rev-list --count ${range})"
{
echo "body<<EOF"
echo "## Summary"
echo "- Release \`${current_tag}\`"
echo "${summary_line}"
echo "- Total commits: ${commit_count}"
echo
echo "## Commits"
git log --pretty='- %h %s' ${range}
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.vars.outputs.version }}
name: Ode CLI v${{ steps.vars.outputs.version }}
prerelease: false
body: ${{ steps.notes.outputs.body }}
files: |
dist/**/ode-*
dist/SHA256SUMS