mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-03-27 03:33:24 +00:00
- Re-enabled the pull_request trigger for specific paths to enhance workflow automation. - Updated macOS build hosts to use specific versions (macos-15-arm64 and macos-15-intel) for improved compatibility and performance during the release process.
401 lines
14 KiB
YAML
401 lines
14 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
pull_request:
|
|
paths:
|
|
- ".github/workflows/release.yml"
|
|
- ".github/actions/publish-artifacts/**"
|
|
workflow_dispatch:
|
|
|
|
# From: https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflows/release.yaml#L13-L21
|
|
env:
|
|
CARGO_INCREMENTAL: 0
|
|
CARGO_NET_RETRY: 10
|
|
RUSTUP_MAX_RETRIES: 10
|
|
|
|
jobs:
|
|
# CLI builds for v2
|
|
# cli-build:
|
|
# strategy:
|
|
# matrix:
|
|
# include:
|
|
# # macOS builds
|
|
# - host: self-hosted
|
|
# target: aarch64-apple-darwin
|
|
# platform: macos-aarch64
|
|
# - host: macos-15-intel
|
|
# target: x86_64-apple-darwin
|
|
# platform: macos-x86_64
|
|
# # Linux builds
|
|
# - host: ubuntu-22.04
|
|
# target: x86_64-unknown-linux-gnu
|
|
# platform: linux-x86_64
|
|
# # Windows builds
|
|
# - host: windows-latest
|
|
# target: x86_64-pc-windows-msvc
|
|
# platform: windows-x86_64
|
|
# name: CLI - ${{ matrix.platform }}
|
|
# runs-on: ${{ matrix.host }}
|
|
# steps:
|
|
# - name: Checkout repository
|
|
# uses: actions/checkout@v4
|
|
|
|
# - name: Setup Rust
|
|
# uses: dtolnay/rust-toolchain@stable
|
|
# with:
|
|
# targets: ${{ matrix.target }}
|
|
|
|
# - name: Setup System and Rust
|
|
# uses: ./.github/actions/setup-system
|
|
# with:
|
|
# token: ${{ secrets.GITHUB_TOKEN }}
|
|
# target: ${{ matrix.target }}
|
|
|
|
# - name: Install cross-compilation tools (Linux ARM)
|
|
# if: matrix.target == 'aarch64-unknown-linux-gnu'
|
|
# run: |
|
|
# sudo apt-get update
|
|
# sudo apt-get install -y gcc-aarch64-linux-gnu
|
|
|
|
# - name: Setup native dependencies
|
|
# run: cargo run -p xtask -- setup
|
|
|
|
# - name: Build CLI binaries
|
|
# run: |
|
|
# cargo build --release --bin sd-cli --bin sd-daemon --features heif,ffmpeg --target ${{ matrix.target }}
|
|
# env:
|
|
# # Set linker for cross-compilation
|
|
# CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
|
|
|
# - name: Prepare binaries (Unix)
|
|
# if: runner.os != 'Windows'
|
|
# run: |
|
|
# mkdir -p dist
|
|
# cp target/${{ matrix.target }}/release/sd-cli dist/sd-${{ matrix.platform }}
|
|
# cp target/${{ matrix.target }}/release/sd-daemon dist/sd-daemon-${{ matrix.platform }}
|
|
# chmod +x dist/*
|
|
|
|
# - name: Prepare binaries (Windows)
|
|
# if: runner.os == 'Windows'
|
|
# shell: pwsh
|
|
# run: |
|
|
# New-Item -ItemType Directory -Force -Path dist
|
|
# Copy-Item target/${{ matrix.target }}/release/sd-cli.exe dist/sd-${{ matrix.platform }}.exe
|
|
# Copy-Item target/${{ matrix.target }}/release/sd-daemon.exe dist/sd-daemon-${{ matrix.platform }}.exe
|
|
|
|
# - name: Generate checksums
|
|
# shell: bash
|
|
# run: |
|
|
# cd dist
|
|
# if [ "$RUNNER_OS" == "Windows" ]; then
|
|
# sha256sum *.exe > checksums-${{ matrix.platform }}.txt
|
|
# else
|
|
# sha256sum * > checksums-${{ matrix.platform }}.txt
|
|
# fi
|
|
|
|
# - name: Upload artifacts
|
|
# uses: actions/upload-artifact@v4
|
|
# with:
|
|
# name: cli-${{ matrix.platform }}
|
|
# path: dist/*
|
|
|
|
# Server builds for self-hosting
|
|
server-build:
|
|
strategy:
|
|
matrix:
|
|
settings:
|
|
- host: ubuntu-22.04
|
|
target: x86_64-unknown-linux-gnu
|
|
platform: linux-x86_64
|
|
- host: ubuntu-22.04
|
|
target: aarch64-unknown-linux-gnu
|
|
platform: linux-aarch64
|
|
name: Server - ${{ matrix.settings.platform }}
|
|
runs-on: ${{ matrix.settings.host }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.settings.target }}
|
|
|
|
- name: Setup System and Rust
|
|
uses: ./.github/actions/setup-system
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
target: ${{ matrix.settings.target }}
|
|
|
|
- name: Configure APT for ARM cross-compilation
|
|
if: matrix.settings.target == 'aarch64-unknown-linux-gnu'
|
|
run: |
|
|
sudo dpkg --add-architecture arm64
|
|
# Mark existing sources as amd64-only to prevent apt from looking for arm64 packages there
|
|
sudo sed -i 's/^deb /deb [arch=amd64] /' /etc/apt/sources.list
|
|
sudo sed -i 's/^deb-src /deb-src [arch=amd64] /' /etc/apt/sources.list
|
|
# Add arm64 sources pointing to ports.ubuntu.com
|
|
cat <<EOF | sudo tee /etc/apt/sources.list.d/arm64.list
|
|
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy main restricted universe multiverse
|
|
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted universe multiverse
|
|
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-backports main restricted universe multiverse
|
|
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted universe multiverse
|
|
EOF
|
|
|
|
- name: Install cross-compilation tools (ARM)
|
|
if: matrix.settings.target == 'aarch64-unknown-linux-gnu'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
|
|
- name: Install OpenSSL (x86_64)
|
|
if: matrix.settings.target == 'x86_64-unknown-linux-gnu'
|
|
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
|
|
|
|
- name: Install cross OpenSSL (ARM)
|
|
if: matrix.settings.target == 'aarch64-unknown-linux-gnu'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y pkg-config libssl-dev:arm64
|
|
|
|
- name: Install FFmpeg libraries (ARM)
|
|
if: matrix.settings.target == 'aarch64-unknown-linux-gnu'
|
|
run: |
|
|
sudo apt-get install -y \
|
|
libavcodec-dev:arm64 \
|
|
libavformat-dev:arm64 \
|
|
libavutil-dev:arm64 \
|
|
libavfilter-dev:arm64 \
|
|
libavdevice-dev:arm64 \
|
|
libswscale-dev:arm64 \
|
|
libswresample-dev:arm64
|
|
|
|
- name: Setup native dependencies (x86_64)
|
|
if: matrix.settings.target == 'x86_64-unknown-linux-gnu'
|
|
run: cargo run -p xtask -- setup
|
|
env:
|
|
TARGET_TRIPLE: ${{ matrix.settings.target }}
|
|
|
|
- name: Setup native dependencies (aarch64)
|
|
if: matrix.settings.target == 'aarch64-unknown-linux-gnu'
|
|
run: cargo run -p xtask -- setup
|
|
env:
|
|
TARGET_TRIPLE: ${{ matrix.settings.target }}
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
|
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
|
|
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++
|
|
PKG_CONFIG_SYSROOT_DIR: /
|
|
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
|
|
|
|
- name: Build server binary (x86_64)
|
|
if: matrix.settings.target == 'x86_64-unknown-linux-gnu'
|
|
run: |
|
|
cargo build --release --bin sd-server --features sd-core/heif,sd-core/ffmpeg --target ${{ matrix.settings.target }}
|
|
|
|
- name: Build server binary (aarch64)
|
|
if: matrix.settings.target == 'aarch64-unknown-linux-gnu'
|
|
run: |
|
|
cargo build --release --bin sd-server --features sd-core/heif,sd-core/ffmpeg --target ${{ matrix.settings.target }}
|
|
env:
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
|
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
|
|
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++
|
|
PKG_CONFIG_SYSROOT_DIR: /
|
|
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig
|
|
|
|
- name: Prepare server binary
|
|
run: |
|
|
mkdir -p dist
|
|
cp target/${{ matrix.settings.target }}/release/sd-server dist/sd-server-${{ matrix.settings.platform }}
|
|
chmod +x dist/sd-server-${{ matrix.settings.platform }}
|
|
|
|
- name: Generate checksum
|
|
run: |
|
|
cd dist
|
|
sha256sum sd-server-${{ matrix.settings.platform }} > sd-server-${{ matrix.settings.platform }}.sha256
|
|
|
|
- name: Create archive
|
|
run: |
|
|
cd dist
|
|
tar -czf sd-server-${{ matrix.settings.platform }}.tar.gz sd-server-${{ matrix.settings.platform }} sd-server-${{ matrix.settings.platform }}.sha256
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: server-${{ matrix.settings.platform }}
|
|
path: dist/sd-server-${{ matrix.settings.platform }}.tar.gz
|
|
|
|
# V2 Desktop builds
|
|
desktop-main:
|
|
strategy:
|
|
matrix:
|
|
settings:
|
|
# macOS builds
|
|
- host: macos-15-arm64
|
|
target: aarch64-apple-darwin
|
|
bundles: dmg,app
|
|
os: darwin
|
|
arch: aarch64
|
|
- host: macos-15-intel
|
|
target: x86_64-apple-darwin
|
|
bundles: dmg,app
|
|
os: darwin
|
|
arch: x86_64
|
|
# Windows builds
|
|
- host: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
bundles: msi
|
|
os: windows
|
|
arch: x86_64
|
|
# Linux builds
|
|
- host: ubuntu-22.04
|
|
target: x86_64-unknown-linux-gnu
|
|
bundles: deb
|
|
os: linux
|
|
arch: x86_64
|
|
name: Desktop - Main ${{ matrix.settings.target }}
|
|
runs-on: ${{ matrix.settings.host }}
|
|
steps:
|
|
- name: Maximize build space
|
|
if: ${{ runner.os == 'Linux' }}
|
|
uses: easimon/maximize-build-space@master
|
|
with:
|
|
swap-size-mb: 3072
|
|
root-reserve-mb: 6144
|
|
remove-dotnet: "true"
|
|
remove-codeql: "true"
|
|
remove-haskell: "true"
|
|
remove-docker-images: "true"
|
|
|
|
- name: Symlink target to C:\
|
|
if: ${{ runner.os == 'Windows' }}
|
|
shell: powershell
|
|
run: |
|
|
New-Item -ItemType Directory -Force -Path C:\spacedrive_target
|
|
New-Item -Path target -ItemType Junction -Value C:\spacedrive_target
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Apple API key
|
|
if: ${{ runner.os == 'macOS' }}
|
|
run: |
|
|
mkdir -p ~/.appstoreconnect/private_keys/
|
|
cd ~/.appstoreconnect/private_keys/
|
|
echo ${{ secrets.APPLE_API_KEY_BASE64 }} >> AuthKey_${{ secrets.APPLE_API_KEY }}.p8.base64
|
|
base64 --decode -i AuthKey_${{ secrets.APPLE_API_KEY }}.p8.base64 -o AuthKey_${{ secrets.APPLE_API_KEY }}.p8
|
|
rm AuthKey_${{ secrets.APPLE_API_KEY }}.p8.base64
|
|
|
|
- name: Install Codesigning Certificate
|
|
if: ${{ runner.os == 'macOS' }}
|
|
uses: apple-actions/import-codesign-certs@v2
|
|
with:
|
|
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
|
|
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
|
|
- name: Setup System and Rust
|
|
uses: ./.github/actions/setup-system
|
|
env:
|
|
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
target: ${{ matrix.settings.target }}
|
|
|
|
- name: Setup Bun and dependencies
|
|
uses: ./.github/actions/setup-bun
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Verify native deps were downloaded
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
echo "=== Native dependencies verification ==="
|
|
if [ ! -d "apps/.deps/lib" ]; then
|
|
echo "ERROR: apps/.deps/lib directory does not exist"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Contents of apps/.deps/lib/:"
|
|
ls -lh apps/.deps/lib/ | head -20
|
|
|
|
SO_COUNT=$(find apps/.deps/lib/ -name "*.so*" | wc -l)
|
|
echo "Found $SO_COUNT .so files"
|
|
|
|
if [ "$SO_COUNT" -eq 0 ]; then
|
|
echo "ERROR: No .so files found in apps/.deps/lib/"
|
|
exit 1
|
|
fi
|
|
|
|
echo "✓ Native dependencies verified"
|
|
|
|
- name: Build with tauri-action
|
|
uses: tauri-apps/tauri-action@v0
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
|
ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }}
|
|
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
|
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
|
APPLE_PROVIDER_SHORT_NAME: ${{ secrets.APPLE_PROVIDER_SHORT_NAME }}
|
|
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
|
|
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
CFLAGS: ${{ matrix.settings.arch == 'aarch64' && '-march=armv8.2-a+crypto' || '' }}
|
|
CXXFLAGS: ${{ matrix.settings.arch == 'aarch64' && '-march=armv8.2-a+crypto' || '' }}
|
|
CPATH: ${{ github.workspace }}/apps/.deps/include
|
|
C_INCLUDE_PATH: ${{ github.workspace }}/apps/.deps/include
|
|
with:
|
|
projectPath: apps/tauri
|
|
args: --target ${{ matrix.settings.target }} --bundles ${{ matrix.settings.bundles }}
|
|
includeUpdaterJson: true
|
|
|
|
- name: Package frontend
|
|
if: ${{ runner.os == 'Linux' }}
|
|
run: |
|
|
set -eux
|
|
XZ_OPT='-T0 -7' tar -cJf apps/tauri/dist.tar.xz -C apps/tauri/dist .
|
|
|
|
- name: Publish Artifacts
|
|
uses: ./.github/actions/publish-artifacts
|
|
with:
|
|
os: ${{ matrix.settings.os }}
|
|
arch: ${{ matrix.settings.arch }}
|
|
target: ${{ matrix.settings.target }}
|
|
profile: release
|
|
|
|
- name: Cleanup keychain
|
|
if: always() && runner.os == 'macOS'
|
|
run: security delete-keychain signing_temp.keychain || true
|
|
|
|
# Create unified release with Server, CLI, and Desktop artifacts
|
|
release:
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
runs-on: self-hosted
|
|
name: Create Release
|
|
needs: [server-build, desktop-main]
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
draft: true
|
|
files: |
|
|
cli-*/*
|
|
server-*/*
|
|
*/*.dmg
|
|
*/*.msi
|
|
*/*.deb
|
|
*/*.tar.xz
|
|
*/*.tar.gz
|
|
*/*.sig
|
|
*/*.json
|