-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (151 loc) · 5.32 KB
/
release.yml
File metadata and controls
180 lines (151 loc) · 5.32 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release (e.g. v0.5.0)"
required: true
env:
CARGO_TERM_COLOR: always
BINARY_NAME: diffmind
jobs:
# ─── Build cross-platform binaries ─────────────────────────────────────────
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
if: github.repository_owner == 'thinkgrid-labs'
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
archive: tar.gz
cross: false
- target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
archive: tar.gz
cross: true
- target: x86_64-apple-darwin
runner: macos-latest
archive: tar.gz
cross: false
- target: aarch64-apple-darwin
runner: macos-latest
archive: tar.gz
cross: false
- target: x86_64-pc-windows-msvc
runner: windows-latest
archive: zip
cross: false
steps:
- uses: actions/checkout@v4
- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross (aarch64-linux)
if: matrix.cross == true
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Cache
uses: Swatinem/rust-cache@v2
with:
key: release-${{ matrix.target }}
- name: Build (native)
if: matrix.cross == false
run: cargo build --release --target ${{ matrix.target }}
- name: Build (cross)
if: matrix.cross == true
run: cross build --release --target ${{ matrix.target }}
# ── Package ──────────────────────────────────────────────────────────
- name: Package (tar.gz — Unix)
if: matrix.archive == 'tar.gz'
shell: bash
run: |
ASSET="${{ env.BINARY_NAME }}-${{ matrix.target }}"
mkdir -p dist
cp target/${{ matrix.target }}/release/${{ env.BINARY_NAME }} dist/
cp README.md LICENSE dist/
tar -czf "${ASSET}.tar.gz" -C dist .
echo "ASSET=${ASSET}.tar.gz" >> $GITHUB_ENV
- name: Package (zip — Windows)
if: matrix.archive == 'zip'
shell: pwsh
run: |
$asset = "${{ env.BINARY_NAME }}-${{ matrix.target }}"
New-Item -ItemType Directory -Force dist | Out-Null
Copy-Item "target\${{ matrix.target }}\release\${{ env.BINARY_NAME }}.exe" dist\
Copy-Item README.md dist\
Copy-Item LICENSE dist\
Compress-Archive -Path dist\* -DestinationPath "${asset}.zip"
"ASSET=${asset}.zip" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.BINARY_NAME }}-${{ matrix.target }}
path: ${{ env.ASSET }}
retention-days: 1
# ─── Create GitHub Release ─────────────────────────────────────────────────
release:
name: Publish GitHub Release
runs-on: ubuntu-latest
needs: build
if: github.repository_owner == 'thinkgrid-labs'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Copy install script to artifacts
run: cp install.sh artifacts/install.sh
- name: Generate checksums (SHA-256)
run: |
cd artifacts
sha256sum * > checksums.txt
cat checksums.txt
- name: Extract release notes from tag
id: notes
run: |
TAG="${{ github.ref_name }}"
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: diffmind ${{ steps.notes.outputs.tag }}
tag_name: ${{ steps.notes.outputs.tag }}
draft: false
prerelease: ${{ contains(steps.notes.outputs.tag, '-') }}
generate_release_notes: true
files: |
artifacts/*
body: |
## Installation
Download the binary for your platform below, then:
**Linux / macOS**
```bash
tar -xzf diffmind-<target>.tar.gz
sudo mv diffmind /usr/local/bin/
diffmind download # one-time model setup
```
**Windows**
Extract the `.zip`, place `diffmind.exe` somewhere on your `PATH`, then run:
```powershell
diffmind download
```
**Build from source**
```bash
cargo install diffmind
```
## SHA-256 checksums
See `checksums.txt` in the release assets.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}