-
Notifications
You must be signed in to change notification settings - Fork 1
240 lines (195 loc) · 6.58 KB
/
Copy pathrelease.yml
File metadata and controls
240 lines (195 loc) · 6.58 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: Build and Release Binaries
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
default: 'v0.1.0'
permissions:
contents: write
jobs:
build:
name: Build for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: aofctl
asset_name: aofctl-linux-x86_64
# macOS
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: aofctl
asset_name: aofctl-macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: aofctl
asset_name: aofctl-macos-aarch64
# Windows
- os: windows-latest
target: x86_64-pc-windows-gnu
artifact_name: aofctl.exe
asset_name: aofctl-windows-x86_64.exe
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross (for cross-compilation)
if: matrix.os == 'ubuntu-latest' && matrix.target == 'aarch64-unknown-linux-gnu'
run: cargo install cross
- name: Build binary
run: |
if [ "${{ matrix.os }}" == "ubuntu-latest" ] && [ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]; then
cross build --release --target ${{ matrix.target }} --package aofctl
else
cargo build --release --target ${{ matrix.target }} --package aofctl
fi
shell: bash
- name: Calculate SHA256 checksum
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
certutil -hashfile "target/${{ matrix.target }}/release/${{ matrix.artifact_name }}" SHA256 | grep -v "^$" | head -1 > checksum.txt
else
sha256sum "target/${{ matrix.target }}/release/${{ matrix.artifact_name }}" | awk '{print $1}' > checksum.txt
fi
shell: bash
- name: Create release asset directory
run: |
mkdir -p release_assets
cp "target/${{ matrix.target }}/release/${{ matrix.artifact_name }}" "release_assets/${{ matrix.asset_name }}"
cp checksum.txt "release_assets/${{ matrix.asset_name }}.sha256"
shell: bash
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.target }}
path: release_assets/
create-release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release_artifacts
- name: Flatten artifacts
run: |
mkdir -p final_artifacts
find release_artifacts -type f -exec cp {} final_artifacts/ \;
ls -la final_artifacts/
- name: Create Release Notes
run: |
VERSION=${{ github.ref_name }}
cat > RELEASE_NOTES.md <<EOF
# AOF $VERSION Release
## Installation
### Using install script (recommended)
\`\`\`bash
curl -sSL https://docs.aof.sh/install.sh | bash
\`\`\`
### Manual download
Download the appropriate binary for your platform below and add it to your PATH.
**Supported platforms:**
- Linux x86_64
- macOS x86_64 (Intel)
- macOS aarch64 (Apple Silicon)
- Windows x86_64
### Verify checksum
\`\`\`bash
sha256sum -c aofctl-*.sha256
\`\`\`
## Changelog
See commit history for detailed changes.
## Getting Started
After installation, verify it works:
\`\`\`bash
aofctl --version
aofctl api-resources
\`\`\`
Check out the [documentation](https://docs.aof.sh) to get started!
EOF
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: final_artifacts/*
body_path: RELEASE_NOTES.md
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-crates:
name: Publish to crates.io
needs: create-release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Publish crates in dependency order
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
# Crates in dependency order (leaf dependencies first)
CRATES=(
"aof-core"
"aof-mcp"
"aof-llm"
"aof-memory"
"aof-tools"
"aof-runtime"
"aof-triggers"
"aofctl"
)
# Wait time between publishes to allow crates.io index to update
WAIT_SECONDS=30
for crate in "${CRATES[@]}"; do
echo "📦 Publishing $crate..."
cargo publish -p "$crate" --no-verify || true
echo "⏳ Waiting ${WAIT_SECONDS}s for crates.io index to update..."
sleep $WAIT_SECONDS
done
echo "✅ All crates published!"
deploy-install-script:
name: Deploy install.sh to web
needs: create-release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy install script
run: |
echo "Install script would be deployed to: https://docs.aof.sh/install.sh"
echo "Location: scripts/install.sh"
echo ""
echo "Steps to configure:"
echo "1. Add scripts/install.sh to your web server"
echo "2. Configure aof.sh to serve it at /install.sh"
echo "3. Ensure GitHub releases are accessible"
- name: Create artifact for deployment
run: |
mkdir -p deploy
cp scripts/install.sh deploy/install.sh
chmod +x deploy/install.sh
- name: Upload deploy artifact
uses: actions/upload-artifact@v4
with:
name: install-script
path: deploy/install.sh