Skip to content

Merge pull request #208 from Stivenjs/console-mode #197

Merge pull request #208 from Stivenjs/console-mode

Merge pull request #208 from Stivenjs/console-mode #197

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build-cli-windows:
runs-on: windows-latest
env:
DEFINE_API_URL: "process.env.SYNC_GAMES_API_URL='${{ secrets.SYNC_GAMES_API_URL }}'"
DEFINE_API_KEY: "process.env.SYNC_GAMES_API_KEY='${{ secrets.SYNC_GAMES_API_KEY }}'"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Sync version from tag
run: bun run scripts/sync-version.ts
env:
GITHUB_REF: ${{ github.ref }}
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build CLI (Windows x64)
run: |
New-Item -ItemType Directory -Force -Path dist
bun build apps/cli/index.ts --compile --outfile dist/savecloud-windows-x64.exe --define $env:DEFINE_API_URL --define $env:DEFINE_API_KEY --minify --windows-icon assets/icon.ico
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cli-windows
path: dist/savecloud-windows-x64.exe
build-cli-unix:
runs-on: ubuntu-latest
env:
DEFINE_API_URL: "process.env.SYNC_GAMES_API_URL='${{ secrets.SYNC_GAMES_API_URL }}'"
DEFINE_API_KEY: "process.env.SYNC_GAMES_API_KEY='${{ secrets.SYNC_GAMES_API_KEY }}'"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Sync version from tag
run: bun run scripts/sync-version.ts
env:
GITHUB_REF: ${{ github.ref }}
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build CLI (Linux x64)
run: |
mkdir -p dist
bun build apps/cli/index.ts --compile --target=bun-linux-x64 --outfile dist/savecloud-linux-x64 \
--define "$DEFINE_API_URL" --define "$DEFINE_API_KEY" --minify
- name: Build CLI (macOS arm64)
run: |
bun build apps/cli/index.ts --compile --target=bun-darwin-arm64 --outfile dist/savecloud-darwin-arm64 \
--define "$DEFINE_API_URL" --define "$DEFINE_API_KEY" --minify
- name: Build CLI (macOS x64)
run: |
bun build apps/cli/index.ts --compile --target=bun-darwin-x64 --outfile dist/savecloud-darwin-x64 \
--define "$DEFINE_API_URL" --define "$DEFINE_API_KEY" --minify
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cli-unix
path: |
dist/savecloud-linux-x64
dist/savecloud-darwin-arm64
dist/savecloud-darwin-x64
build-desktop:
strategy:
fail-fast: false
matrix:
include:
- platform: windows-latest
artifactName: desktop-windows
args: ""
- platform: ubuntu-22.04
artifactName: desktop-linux
args: ""
- platform: macos-latest
artifactName: desktop-macos-universal
args: "--target universal-apple-darwin"
rustTargets: "aarch64-apple-darwin x86_64-apple-darwin"
runs-on: ${{ matrix.platform }}
env:
SYNC_GAMES_API_URL: ${{ secrets.SYNC_GAMES_API_URL }}
SYNC_GAMES_API_KEY: ${{ secrets.SYNC_GAMES_API_KEY }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rustTargets || '' }}
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "apps/desktop/src-tauri -> target"
- name: Sync version from tag
run: bun run scripts/sync-version.ts
env:
GITHUB_REF: ${{ github.ref }}
# Build deps on Ubuntu; runtime deps for installers live in tauri.conf.json:
# bundle.linux.deb.depends (apt/dpkg), bundle.linux.rpm.depends (dnf/rpm).
# AUR / pacman: no .deb/.rpm metadata — mirror the same libs in PKGBUILD depends (see those lists).
- name: Install dependencies (Ubuntu)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libasound2-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libudev-dev build-essential curl wget file libxdo-dev libssl-dev
- name: Install dependencies
run: bun install --frozen-lockfile
working-directory: apps/desktop
- name: NSIS branding (Windows)
if: matrix.platform == 'windows-latest'
run: bun run nsis-branding
working-directory: apps/desktop
- name: Build Tauri
run: bun run tauri build ${{ matrix.args }}
working-directory: apps/desktop
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifactName }}
path: apps/desktop/src-tauri/target/**/release/bundle/
release:
needs: [build-cli-windows, build-cli-unix, build-desktop]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Consolidate release files
run: |
mkdir -p release
find cli-windows -type f -exec cp {} release/ \;
find cli-unix -type f -exec cp {} release/ \;
for dir in desktop-*; do
[ -d "$dir" ] && find "$dir" -type f \( -name "*.msi" -o -name "*.exe" -o -name "*.AppImage" -o -name "*.deb" -o -name "*.rpm" -o -name "*.dmg" -o -name "*.sig" -o -name "*.app.tar.gz" -o -name "*.tar.gz" -o -name "*.zip" \) -exec cp {} release/ \;
done
- name: Generate updater latest.json
run: bun run scripts/generate-updater-json.ts
env:
GITHUB_REF: ${{ github.ref }}
GITHUB_REPOSITORY: ${{ github.repository }}
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}