-
Notifications
You must be signed in to change notification settings - Fork 0
239 lines (203 loc) · 7.78 KB
/
release.yml
File metadata and controls
239 lines (203 loc) · 7.78 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
binary: fm-x86_64-unknown-linux-musl
- target: x86_64-apple-darwin
os: macos-latest
binary: fm-x86_64-apple-darwin
- target: aarch64-apple-darwin
os: macos-latest
binary: fm-aarch64-apple-darwin
- target: x86_64-pc-windows-msvc
os: windows-latest
binary: fm-x86_64-pc-windows-msvc.exe
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install musl-tools (Linux)
if: contains(matrix.target, 'musl')
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Cache cargo registry & build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.target }}-cargo-
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Rename binary (Unix)
if: runner.os != 'Windows'
run: |
cp target/${{ matrix.target }}/release/fm ${{ matrix.binary }}
chmod +x ${{ matrix.binary }}
- name: Rename binary (Windows)
if: runner.os == 'Windows'
run: |
copy target\${{ matrix.target }}\release\fm.exe ${{ matrix.binary }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary }}
path: ${{ matrix.binary }}
# Build .deb package for Debian/Ubuntu
build-deb:
name: Build .deb package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry & build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-deb-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-deb-cargo-
- name: Install cargo-deb
run: cargo install cargo-deb
- name: Build .deb package
run: cargo deb
- name: Upload .deb artifact
uses: actions/upload-artifact@v4
with:
name: fm-deb
path: target/debian/*.deb
# Build AppImage for portable Linux
build-appimage:
name: Build AppImage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Cache cargo registry & build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-appimage-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-appimage-cargo-
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libfuse2
- name: Build release binary
run: cargo build --release --target x86_64-unknown-linux-gnu
- name: Create AppDir structure
run: |
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/share/applications
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
# Copy binary
cp target/x86_64-unknown-linux-gnu/release/fm AppDir/usr/bin/fm
chmod +x AppDir/usr/bin/fm
# Create desktop entry
cat > AppDir/usr/share/applications/fm-tui.desktop << 'DESKTOP'
[Desktop Entry]
Name=fm-tui
Comment=A fast, keyboard-driven terminal file manager
Exec=fm
Icon=fm-tui
Type=Application
Terminal=true
Categories=System;FileManager;ConsoleOnly;
DESKTOP
# Symlink desktop file to AppDir root (required by AppImage)
cp AppDir/usr/share/applications/fm-tui.desktop AppDir/fm-tui.desktop
# Create a simple SVG icon
cat > AppDir/usr/share/icons/hicolor/256x256/apps/fm-tui.svg << 'SVG'
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">
<rect width="256" height="256" rx="32" fill="#1e1e2e"/>
<rect x="24" y="48" width="208" height="168" rx="12" fill="#313244" stroke="#89b4fa" stroke-width="3"/>
<line x1="128" y1="48" x2="128" y2="216" stroke="#585b70" stroke-width="2"/>
<rect x="24" y="48" width="208" height="28" rx="12" fill="#45475a"/>
<circle cx="48" cy="62" r="6" fill="#f38ba8"/>
<circle cx="68" cy="62" r="6" fill="#a6e3a1"/>
<circle cx="88" cy="62" r="6" fill="#f9e2af"/>
<text x="44" y="104" font-family="monospace" font-size="14" fill="#89b4fa">📁 src/</text>
<text x="44" y="124" font-family="monospace" font-size="14" fill="#cdd6f4"> main.rs</text>
<text x="44" y="144" font-family="monospace" font-size="14" fill="#cdd6f4"> app.rs</text>
<text x="44" y="164" font-family="monospace" font-size="14" fill="#89b4fa">📁 tests/</text>
<text x="148" y="104" font-family="monospace" font-size="12" fill="#a6e3a1">fn main()</text>
<text x="148" y="124" font-family="monospace" font-size="12" fill="#cdd6f4"> let app</text>
<text x="148" y="144" font-family="monospace" font-size="12" fill="#cdd6f4"> app.run</text>
</svg>
SVG
# Symlink icon to AppDir root
cp AppDir/usr/share/icons/hicolor/256x256/apps/fm-tui.svg AppDir/fm-tui.svg
# Create AppRun script
cat > AppDir/AppRun << 'APPRUN'
#!/bin/bash
SELF=$(readlink -f "$0")
HERE=${SELF%/*}
export PATH="${HERE}/usr/bin:${PATH}"
exec "${HERE}/usr/bin/fm" "$@"
APPRUN
chmod +x AppDir/AppRun
- name: Download appimagetool
run: |
wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool
chmod +x appimagetool
- name: Build AppImage
run: |
ARCH=x86_64 ./appimagetool --appimage-extract-and-run AppDir fm-tui-x86_64.AppImage
- name: Upload AppImage artifact
uses: actions/upload-artifact@v4
with:
name: fm-appimage
path: fm-tui-x86_64.AppImage
release:
name: Create Release
needs: [build, build-deb, build-appimage]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Collect binaries
run: |
mkdir -p release
# Copy platform binaries
find artifacts -type f -name 'fm-*' -exec cp {} release/ \;
# Copy .deb package
find artifacts -type f -name '*.deb' -exec cp {} release/ \;
# Copy AppImage
find artifacts -type f -name '*.AppImage' -exec cp {} release/ \;
ls -la release/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}