Skip to content

Commit b9fdf28

Browse files
committed
initial release: sf — terminal file manager written in ARO
Midnight Commander-style dual-panel file manager with keyboard navigation, file preview, and directory browsing. Includes CI/CD pipeline with signed macOS builds and Homebrew tap support.
0 parents  commit b9fdf28

File tree

9 files changed

+872
-0
lines changed

9 files changed

+872
-0
lines changed

.github/workflows/build.yml

Lines changed: 343 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,343 @@
1+
name: Build & Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ['*']
7+
pull_request:
8+
branches: [main]
9+
10+
env:
11+
ARO_VERSION: latest
12+
SWIFT_VERSION: '6.2.1'
13+
14+
jobs:
15+
# ===========================================================================
16+
# Check — syntax-check on both platforms
17+
# ===========================================================================
18+
check:
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- os: ubuntu-22.04
24+
asset: aro-linux-amd64.tar.gz
25+
- os: macos-latest
26+
asset: aro-macos-arm64.tar.gz
27+
runs-on: ${{ matrix.os }}
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
32+
- name: Install dependencies (Linux)
33+
if: runner.os == 'Linux'
34+
run: |
35+
sudo apt-get update -qq
36+
sudo apt-get install -y -qq libgit2-dev
37+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
38+
echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" | sudo tee /etc/apt/sources.list.d/llvm.list
39+
sudo apt-get update -qq
40+
sudo apt-get install -y -qq libllvm20
41+
42+
- name: Install ARO (Linux)
43+
if: runner.os == 'Linux'
44+
run: |
45+
if [ "$ARO_VERSION" = "latest" ]; then
46+
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/arolang/aro/releases/latest \
47+
| grep "browser_download_url.*${{ matrix.asset }}" \
48+
| cut -d '"' -f 4)
49+
else
50+
DOWNLOAD_URL="https://github.com/arolang/aro/releases/download/${ARO_VERSION}/${{ matrix.asset }}"
51+
fi
52+
curl -fsSL "$DOWNLOAD_URL" | tar xz
53+
sudo mv aro /usr/local/bin/
54+
sudo mv libARORuntime.a /usr/local/lib/
55+
aro --version
56+
57+
- name: Install ARO (macOS)
58+
if: runner.os == 'macOS'
59+
run: |
60+
brew tap arolang/aro
61+
brew install aro libgit2 llvm@20
62+
aro --version
63+
64+
- name: Check code
65+
run: aro check .
66+
67+
# ===========================================================================
68+
# Build — compile for macOS (signed) and Linux
69+
# ===========================================================================
70+
build-linux:
71+
needs: check
72+
runs-on: ubuntu-22.04
73+
steps:
74+
- name: Checkout repository
75+
uses: actions/checkout@v4
76+
77+
- name: Install Swift
78+
run: |
79+
curl -fsSL "https://download.swift.org/swift-${SWIFT_VERSION}-release/ubuntu2204/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-ubuntu22.04.tar.gz" -o swift.tar.gz
80+
sudo mkdir -p /usr/share/swift
81+
sudo tar xzf swift.tar.gz -C /usr/share/swift --strip-components=1
82+
echo "/usr/share/swift/usr/bin" >> $GITHUB_PATH
83+
rm swift.tar.gz
84+
85+
- name: Install dependencies
86+
run: |
87+
sudo apt-get update -qq
88+
sudo apt-get install -y -qq libgit2-dev
89+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg
90+
echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-20 main" | sudo tee /etc/apt/sources.list.d/llvm.list
91+
sudo apt-get update -qq
92+
sudo apt-get install -y -qq llvm-20
93+
sudo ln -sf /usr/lib/llvm-20/bin/llc /usr/local/bin/llc
94+
sudo ln -sf /usr/lib/llvm-20/bin/clang /usr/local/bin/clang
95+
96+
- name: Install ARO
97+
run: |
98+
if [ "$ARO_VERSION" = "latest" ]; then
99+
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/arolang/aro/releases/latest \
100+
| grep "browser_download_url.*aro-linux-amd64.tar.gz" \
101+
| cut -d '"' -f 4)
102+
else
103+
DOWNLOAD_URL="https://github.com/arolang/aro/releases/download/${ARO_VERSION}/aro-linux-amd64.tar.gz"
104+
fi
105+
curl -fsSL "$DOWNLOAD_URL" | tar xz
106+
sudo mv aro /usr/local/bin/
107+
sudo mv libARORuntime.a /usr/local/lib/
108+
109+
- name: Build
110+
run: aro build . --optimize --strip --size -o sf
111+
112+
- name: Upload artifact
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: sf-linux-amd64
116+
path: sf
117+
118+
build-macos:
119+
needs: check
120+
runs-on: macos-latest
121+
steps:
122+
- name: Checkout repository
123+
uses: actions/checkout@v4
124+
125+
- name: Install Swift
126+
run: |
127+
curl -fsSL "https://download.swift.org/swift-${SWIFT_VERSION}-release/xcode/swift-${SWIFT_VERSION}-RELEASE/swift-${SWIFT_VERSION}-RELEASE-osx.pkg" -o swift.pkg
128+
sudo installer -pkg swift.pkg -target /
129+
TOOLCHAIN_BIN="/Library/Developer/Toolchains/swift-${SWIFT_VERSION}-RELEASE.xctoolchain/usr/bin"
130+
echo "$TOOLCHAIN_BIN" >> $GITHUB_PATH
131+
rm swift.pkg
132+
133+
- name: Install ARO
134+
run: |
135+
brew tap arolang/aro
136+
brew install aro libgit2 llvm@20
137+
echo "/opt/homebrew/opt/llvm@20/bin" >> $GITHUB_PATH
138+
139+
- name: Import Code Signing Certificate
140+
if: github.ref_type == 'tag' && secrets.APPLE_CERTIFICATE_BASE64 != ''
141+
env:
142+
APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
143+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
144+
run: |
145+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
146+
KEYCHAIN_PASSWORD=$(openssl rand -base64 32)
147+
148+
echo "$APPLE_CERTIFICATE_BASE64" | base64 --decode > certificate.p12
149+
150+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
151+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
152+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
153+
154+
security import certificate.p12 \
155+
-P "$APPLE_CERTIFICATE_PASSWORD" \
156+
-A \
157+
-t cert \
158+
-f pkcs12 \
159+
-k $KEYCHAIN_PATH
160+
161+
security list-keychain -d user -s $KEYCHAIN_PATH
162+
security set-key-partition-list \
163+
-S apple-tool:,apple: \
164+
-s \
165+
-k "$KEYCHAIN_PASSWORD" \
166+
$KEYCHAIN_PATH
167+
168+
rm certificate.p12
169+
170+
- name: Build (signed)
171+
if: github.ref_type == 'tag' && secrets.APPLE_TEAM_ID != ''
172+
env:
173+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
174+
run: |
175+
aro build . --sign "$APPLE_TEAM_ID" --optimize --strip --size -o sf
176+
codesign --verify --verbose sf
177+
178+
- name: Build (unsigned)
179+
if: github.ref_type != 'tag' || secrets.APPLE_TEAM_ID == ''
180+
run: aro build . --optimize --strip --size -o sf
181+
182+
- name: Notarize Binary
183+
if: github.ref_type == 'tag' && secrets.APPLE_ID != ''
184+
env:
185+
APPLE_ID: ${{ secrets.APPLE_ID }}
186+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
187+
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
188+
run: |
189+
zip -r sf.zip sf
190+
xcrun notarytool submit sf.zip \
191+
--apple-id "$APPLE_ID" \
192+
--team-id "$APPLE_TEAM_ID" \
193+
--password "$APPLE_APP_PASSWORD" \
194+
--wait
195+
# Staple may fail for CLI tools — that's OK
196+
xcrun stapler staple sf || true
197+
198+
- name: Upload artifact
199+
uses: actions/upload-artifact@v4
200+
with:
201+
name: sf-macos-arm64
202+
path: sf
203+
204+
# ===========================================================================
205+
# Release — create GitHub release on tag push
206+
# ===========================================================================
207+
release:
208+
name: Create Release
209+
needs: [build-linux, build-macos]
210+
runs-on: ubuntu-latest
211+
if: github.ref_type == 'tag'
212+
permissions:
213+
contents: write
214+
steps:
215+
- name: Checkout repository
216+
uses: actions/checkout@v4
217+
218+
- name: Download all artifacts
219+
uses: actions/download-artifact@v4
220+
with:
221+
path: artifacts
222+
223+
- name: Package release assets
224+
run: |
225+
cd artifacts/sf-linux-amd64
226+
chmod +x sf
227+
tar -czvf ../sf-linux-amd64.tar.gz sf
228+
cd ../..
229+
230+
cd artifacts/sf-macos-arm64
231+
chmod +x sf
232+
tar -czvf ../sf-macos-arm64.tar.gz sf
233+
cd ../..
234+
235+
- name: Extract version from tag
236+
id: version
237+
run: |
238+
VERSION="${{ github.ref_name }}"
239+
VERSION="${VERSION#v}"
240+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
241+
242+
- name: Create GitHub Release
243+
uses: softprops/action-gh-release@v2
244+
with:
245+
name: sf ${{ steps.version.outputs.version }}
246+
draft: false
247+
prerelease: ${{ contains(github.ref_name, '-') }}
248+
generate_release_notes: true
249+
files: |
250+
artifacts/sf-linux-amd64.tar.gz
251+
artifacts/sf-macos-arm64.tar.gz
252+
body: |
253+
## ShowFiles ${{ steps.version.outputs.version }}
254+
255+
A Midnight Commander-style terminal file manager written in ARO.
256+
257+
### Downloads
258+
259+
| Platform | Architecture | Download |
260+
|----------|--------------|----------|
261+
| macOS | Apple Silicon | [sf-macos-arm64.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/sf-macos-arm64.tar.gz) |
262+
| Linux | x86_64 | [sf-linux-amd64.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/sf-linux-amd64.tar.gz) |
263+
264+
### Installation
265+
266+
**macOS (Homebrew)**
267+
```bash
268+
brew tap arolang/applications
269+
brew install sf
270+
```
271+
272+
**macOS (Manual)**
273+
```bash
274+
curl -fsSL https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/sf-macos-arm64.tar.gz | tar xz
275+
sudo mv sf /usr/local/bin/
276+
```
277+
278+
**Linux**
279+
```bash
280+
curl -fsSL https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/sf-linux-amd64.tar.gz | tar xz
281+
sudo mv sf /usr/local/bin/
282+
```
283+
284+
# ======================================================================
285+
# Update Homebrew Formula
286+
# ======================================================================
287+
- name: Update Homebrew Formula
288+
continue-on-error: true
289+
env:
290+
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
291+
run: |
292+
SHA256_MACOS=$(shasum -a 256 artifacts/sf-macos-arm64.tar.gz | awk '{print $1}')
293+
SHA256_LINUX=$(shasum -a 256 artifacts/sf-linux-amd64.tar.gz | awk '{print $1}')
294+
VERSION="${{ steps.version.outputs.version }}"
295+
REPO="${{ github.repository }}"
296+
TAG="${{ github.ref_name }}"
297+
298+
echo "Version: $VERSION"
299+
echo "SHA256 macOS: $SHA256_MACOS"
300+
echo "SHA256 Linux: $SHA256_LINUX"
301+
302+
git clone https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/arolang/homebrew-applications.git
303+
cd homebrew-applications
304+
mkdir -p Formula
305+
306+
{
307+
echo 'class Sf < Formula'
308+
echo ' desc "Midnight Commander-style terminal file manager written in ARO"'
309+
echo " homepage \"https://github.com/${REPO}\""
310+
echo " version \"${VERSION}\""
311+
echo ' license "MIT"'
312+
echo ''
313+
echo ' on_macos do'
314+
echo ' depends_on arch: :arm64'
315+
echo " url \"https://github.com/${REPO}/releases/download/${TAG}/sf-macos-arm64.tar.gz\""
316+
echo " sha256 \"${SHA256_MACOS}\""
317+
echo ' end'
318+
echo ''
319+
echo ' on_linux do'
320+
echo " url \"https://github.com/${REPO}/releases/download/${TAG}/sf-linux-amd64.tar.gz\""
321+
echo " sha256 \"${SHA256_LINUX}\""
322+
echo ' end'
323+
echo ''
324+
echo ' def install'
325+
echo ' bin.install "sf"'
326+
echo ' end'
327+
echo ''
328+
echo ' test do'
329+
echo ' assert_match version.to_s, shell_output("#{bin}/sf --version")'
330+
echo ' end'
331+
echo 'end'
332+
} > Formula/sf.rb
333+
334+
git config user.name "github-actions[bot]"
335+
git config user.email "github-actions[bot]@users.noreply.github.com"
336+
337+
git add Formula/sf.rb
338+
if git diff --staged --quiet; then
339+
echo "No changes to formula"
340+
else
341+
git commit -m "chore: update sf to version ${VERSION}"
342+
git push https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/arolang/homebrew-applications.git main
343+
fi

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/sf
2+
/.idea
3+
/.DS_Store

0 commit comments

Comments
 (0)