-
Notifications
You must be signed in to change notification settings - Fork 0
208 lines (177 loc) · 6.51 KB
/
release.yml
File metadata and controls
208 lines (177 loc) · 6.51 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g., v1.0.0)"
required: true
type: string
permissions:
contents: write
packages: write
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux builds
- target: bun-linux-x64
os: ubuntu-latest
artifact: aish-linux-x64
- target: bun-linux-x64-baseline
os: ubuntu-latest
artifact: aish-linux-x64-baseline
- target: bun-linux-arm64
os: ubuntu-latest
artifact: aish-linux-arm64
# macOS builds
- target: bun-darwin-x64
os: macos-13 # Intel runner
artifact: aish-darwin-x64
- target: bun-darwin-arm64
os: macos-14 # Apple Silicon runner
artifact: aish-darwin-arm64
# Windows builds
- target: bun-windows-x64
os: windows-latest
artifact: aish-windows-x64.exe
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build executable
run: |
VERSION=${GITHUB_REF_NAME#v}
bun build --compile --minify --sourcemap --target=${{ matrix.target }} --define AISH_VERSION="\"$VERSION\"" src/index.ts --outfile ${{ matrix.artifact }}
shell: bash
- name: Test executable
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
./${{ matrix.artifact }} --version
else
chmod +x ${{ matrix.artifact }}
# Only test if the binary matches the runner architecture
if [[ "${{ matrix.target }}" == *"arm64"* ]] && [[ "$(uname -m)" != "arm64" ]]; then
echo "Skipping test for ARM64 binary on x64 runner"
file ${{ matrix.artifact }}
else
./${{ matrix.artifact }} --version
fi
fi
shell: bash
- name: Create tarball (Unix)
if: runner.os != 'Windows' && success()
run: |
if [ -f "${{ matrix.artifact }}" ]; then
tar -czf ${{ matrix.artifact }}.tar.gz ${{ matrix.artifact }}
if [ "$RUNNER_OS" == "macOS" ]; then
shasum -a 256 ${{ matrix.artifact }}.tar.gz > ${{ matrix.artifact }}.tar.gz.sha256
else
sha256sum ${{ matrix.artifact }}.tar.gz > ${{ matrix.artifact }}.tar.gz.sha256
fi
else
echo "Binary ${{ matrix.artifact }} not found, skipping tarball creation"
fi
shell: bash
- name: Create zip (Windows)
if: runner.os == 'Windows' && success()
run: |
if exist "${{ matrix.artifact }}" (
7z a ${{ matrix.artifact }}.zip ${{ matrix.artifact }}
certutil -hashfile ${{ matrix.artifact }}.zip SHA256 > ${{ matrix.artifact }}.zip.sha256
) else (
echo Binary ${{ matrix.artifact }} not found, skipping zip creation
)
shell: cmd
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.artifact }}
path: |
${{ matrix.artifact }}*
retention-days: 30
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
if: always() && (needs.build.result == 'success' || needs.build.result == 'failure')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
continue-on-error: true
- name: Prepare release assets
run: |
mkdir -p release-assets
if [ -d "artifacts" ]; then
find artifacts -type f \( -name "*.tar.gz" -o -name "*.zip" -o -name "*.sha256" \) -exec cp {} release-assets/ \; 2>/dev/null || true
fi
echo "Available release assets:"
ls -la release-assets/ || echo "No release assets found"
# Count successful builds
ASSET_COUNT=$(ls release-assets/*.tar.gz release-assets/*.zip 2>/dev/null | wc -l || echo 0)
echo "Found $ASSET_COUNT binary assets"
- name: Generate release notes
id: release_notes
run: |
cat > release_notes.md << 'EOF'
## 🚀 What's New
This release includes pre-compiled binaries for multiple platforms:
### 📦 Downloads
**Linux:**
- `aish-linux-x64.tar.gz` - Standard x64 build
- `aish-linux-x64-baseline.tar.gz` - Compatible with older CPUs (pre-2013)
- `aish-linux-arm64.tar.gz` - ARM64 build for servers like AWS Graviton
**macOS:**
- `aish-darwin-x64.tar.gz` - Intel Macs
- `aish-darwin-arm64.tar.gz` - Apple Silicon Macs (M1/M2/M3)
**Windows:**
- `aish-windows-x64.exe.zip` - Standard x64 build
### 🔧 Installation
**Quick install (recommended):**
```bash
curl -fsSL https://raw.githubusercontent.com/abhishekbhardwaj/aish-cli/main/scripts/install.sh | bash
```
**Manual installation:**
1. Download the appropriate binary for your platform
2. Extract the archive
3. Make executable (Unix): `chmod +x aish`
4. Move to PATH: `mv aish /usr/local/bin/`
### ✅ Verification
All binaries include SHA256 checksums for verification:
```bash
sha256sum -c aish-*.sha256
```
### 🔐 Security
- All binaries are built in GitHub Actions for transparency
- SHA256 checksums provided for verification
EOF
echo "notes<<EOF" >> $GITHUB_OUTPUT
cat release_notes.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name || github.event.inputs.version }}
name: Release ${{ github.ref_name || github.event.inputs.version }}
body: ${{ steps.release_notes.outputs.notes }}
files: release-assets/*
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}