Skip to content

Commit 751fa1b

Browse files
ben-ednaspoorcc
authored andcommitted
Create & release standalone binaries
Fixes #701
1 parent 19f2cf5 commit 751fa1b

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/binaries.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Standalone binaries
2+
3+
on:
4+
push:
5+
tags:
6+
- '*' # Only run for version tags (e.g., v1.0.0)
7+
branches:
8+
- 'spoorcc/issue701'
9+
10+
jobs:
11+
build:
12+
name: Build on ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, windows-latest, macos-latest] # Build for all platforms
17+
18+
steps:
19+
- name: Checkout Repository
20+
uses: actions/checkout@v4
21+
22+
- name: Install Rust
23+
uses: dtolnay/rust-toolchain@stable
24+
25+
- name: Install PyOxidizer
26+
run: cargo install pyoxidizer
27+
28+
- name: Build Optimized Binary
29+
run: pyoxidizer build \
30+
--var=policy.strip_all_shared_libraries=true \
31+
--var=policy.optimize_bytecode=true \
32+
--var=dist.embed_python_stdlib=true \
33+
--var=dist.fully_static=true
34+
35+
- name: Compress Binary with UPX
36+
run: |
37+
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "macOS" ]]; then
38+
sudo apt-get install -y upx
39+
elif [[ "$RUNNER_OS" == "Windows" ]]; then
40+
choco install upx
41+
fi
42+
upx --best --lzma build/dist/*/dfetch*
43+
44+
# - name: Sign Windows Binary
45+
# if: matrix.os == 'windows-latest'
46+
# shell: pwsh
47+
# run: |
48+
# echo "${{ secrets.WINDOWS_CERT }}" | base64 -d > dfetch.pfx
49+
# & "C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool.exe" sign /f dfetch.pfx /p "${{ secrets.WINDOWS_CERT_PASSWORD }}" /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 build/dist/windows/dfetch.exe
50+
51+
# - name: Sign macOS Binary
52+
# if: matrix.os == 'macos-latest'
53+
# run: |
54+
# echo "${{ secrets.APPLE_CERT }}" | base64 --decode > apple-cert.p12
55+
# security import apple-cert.p12 -P "${{ secrets.APPLE_CERT_PASSWORD }}" -A
56+
# codesign --deep --force --verbose --sign "Developer ID Application" build/dist/macos/dfetch
57+
58+
# - name: Sign Linux Binary
59+
# if: matrix.os == 'ubuntu-latest'
60+
# run: |
61+
# echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import
62+
# gpg --batch --yes --detach-sign --armor --passphrase "${{ secrets.GPG_PASSPHRASE }}" --pinentry-mode loopback build/dist/linux/dfetch
63+
64+
- name: Rename Binary for Release
65+
run: |
66+
mv build/dist release
67+
68+
- name: Upload Built Binary
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: dfetch-${{ matrix.os }}
72+
path: release/

0 commit comments

Comments
 (0)