Files
LCE-Emerald-Launcher/.github/workflows/publish.yml
2026-04-02 16:02:58 +03:00

282 lines
12 KiB
YAML

name: 'publish'
on:
workflow_dispatch:
jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest'
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04'
args: ''
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Extract version
id: get_version
shell: bash
run: |
VERSION=$(node -p "require('./package.json').version")
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "APP_VERSION=$VERSION" >> $GITHUB_ENV
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libudev-dev
- name: setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'pnpm'
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: install frontend dependencies
run: pnpm install
- name: Build and create artifacts for macOS
if: matrix.platform == 'macos-latest'
run: |
# Build the app once
pnpm build
cd src-tauri
cargo build --release --target ${{ matrix.args }}
cd ..
# Setup target architecture name
TARGET_ARCH=${{ matrix.args == '--target aarch64-apple-darwin' && 'aarch64-apple-darwin' || 'x86_64-apple-darwin' }}
# Prepare paths for .app bundle
mkdir -p "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Emerald Legacy Launcher.app/Contents/MacOS"
mkdir -p "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Emerald Legacy Launcher.app/Contents/Resources"
cp "src-tauri/target/$TARGET_ARCH/release/emerald-legacy-launcher" "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Emerald Legacy Launcher.app/Contents/MacOS/"
printf '<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n<dict>\n <key>CFBundleExecutable</key>\n <string>emerald-legacy-launcher</string>\n <key>CFBundleIdentifier</key>\n <string>com.emerald.legacy</string>\n <key>CFBundleName</key>\n <string>Emerald Legacy Launcher</string>\n <key>CFBundleVersion</key>\n <string>${{ steps.get_version.outputs.VERSION }}</string>\n <key>CFBundleShortVersionString</key>\n <string>${{ steps.get_version.outputs.VERSION }}</string>\n <key>CFBundlePackageType</key>\n <string>APPL</string>\n <key>NSHighResolutionCapable</key>\n <true/>\n <key>LSApplicationCategoryType</key>\n <string>public.app-category.games</string>\n</dict>\n</plist>\n' > "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Emerald Legacy Launcher.app/Contents/Info.plist"
if [ -f "src-tauri/icons/icon.icns" ]; then
cp src-tauri/icons/icon.icns "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Emerald Legacy Launcher.app/Contents/Resources/"
fi
chmod +x "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Emerald Legacy Launcher.app/Contents/MacOS/emerald-legacy-launcher"
# Create PKG (optional, using the built .app)
mkdir -p pkg_temp/scripts
cp scripts/postinstall.sh pkg_temp/scripts/
pkgbuild --root "src-tauri/target/$TARGET_ARCH/release/bundle/macos" \
--install-location /Applications \
--scripts pkg_temp/scripts \
--identifier "com.emerald.legacy" \
--version "${{ steps.get_version.outputs.VERSION }}" \
"Emerald-Legacy-Launcher.pkg"
# Create DMG
cd "src-tauri/target/$TARGET_ARCH/release/bundle/macos"
hdiutil create -volname "Emerald Legacy Launcher" -srcfolder "Emerald Legacy Launcher.app" -ov -format UDZO "Emerald Legacy Launcher.dmg"
# Move artifacts to final locations
mkdir -p "$GITHUB_WORKSPACE/src-tauri/target/release/bundle/dmg/"
mv "Emerald Legacy Launcher.dmg" "$GITHUB_WORKSPACE/src-tauri/target/release/bundle/dmg/"
mkdir -p "$GITHUB_WORKSPACE/src-tauri/target/release/bundle/macos/"
mv "$GITHUB_WORKSPACE/Emerald-Legacy-Launcher.pkg" "$GITHUB_WORKSPACE/src-tauri/target/release/bundle/macos/"
- name: Build with tauri-action for Windows and Linux
if: matrix.platform != 'macos-latest'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: v${{ steps.get_version.outputs.VERSION }}
releaseName: 'Emerald v${{ steps.get_version.outputs.VERSION }}'
releaseBody: |
# Emerald Legacy Launcher v${{ steps.get_version.outputs.VERSION }}
## 📥 What to download?
### 🐧 GNU/Linux
- **RHEL/Fedora**: `Emerald.Legacy.Launcher-*.rpm`
- **Debian/Ubuntu**: `Emerald.Legacy.Launcher-*.deb`
- **Universal**: `Emerald.Legacy.Launcher-*.AppImage`
- **Flatpak**: `io.github.Emerald_Legacy_Launcher.Emerald_Legacy_Launcher.flatpak`
### 🍎 macOS
- **Intel Mac**: `Emerald.Legacy.Launcher_*.x64.dmg`
- **M-series Mac**: `Emerald.Legacy.Launcher_*.aarch64.dmg`
### 🪟 Windows
- **Setup Installer**: `Emerald.Legacy.Launcher-*.exe`
- **MSI Installer**: `Emerald.Legacy.Launcher-*.msi`
---
## ⚠️ Windows SmartScreen
This software is completely safe. Because the launcher is unsigned, you will see a "Windows protected your PC" window. To proceed:
1. Click the **"More info"** link under the main text.
2. Click the **"Run anyway"** button that appears.
## 🍎 macOS Installation
Download the DMG file, open it, and drag the app to Applications folder.
If you see "app damaged" error, right-click the app → Open → confirm Open.
Or run: `xattr -cr "/Applications/Emerald Legacy Launcher.app"`
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
- name: Upload all artifacts to release
if: matrix.platform != 'macos-latest'
uses: softprops/action-gh-release@v2
with:
files: |
src-tauri/target/release/bundle/deb/*.deb
src-tauri/target/release/bundle/appimage/*.AppImage
src-tauri/target/release/bundle/rpm/*.rpm
src-tauri/target/release/bundle/msi/*.msi
src-tauri/target/release/bundle/nsis/*.exe
tag_name: v${{ steps.get_version.outputs.VERSION }}
name: 'Emerald v${{ steps.get_version.outputs.VERSION }}'
body: |
# Emerald Legacy Launcher v${{ steps.get_version.outputs.VERSION }}
## 📥 What to download?
### 🐧 GNU/Linux
- **RHEL/Fedora**: `Emerald.Legacy.Launcher-*.rpm`
- **Debian/Ubuntu**: `Emerald.Legacy.Launcher-*.deb`
- **Universal**: `Emerald.Legacy.Launcher-*.AppImage`
- **Flatpak**: `io.github.Emerald_Legacy_Launcher.Emerald_Legacy_Launcher.flatpak`
### 🍎 macOS
- **Intel Mac**: `Emerald.Legacy.Launcher_*.x64.dmg`
- **M-series Mac**: `Emerald.Legacy.Launcher_*.aarch64.dmg`
### 🪟 Windows
- **Setup Installer**: `Emerald.Legacy.Launcher-*.exe`
- **MSI Installer**: `Emerald.Legacy.Launcher-*.msi`
---
## ⚠️ Windows SmartScreen
This software is completely safe. Because the launcher is unsigned, you will see a "Windows protected your PC" window. To proceed:
1. Click the **"More info"** link under the main text.
2. Click the **"Run anyway"** button that appears.
## 🍎 macOS Installation
Download the DMG file, open it, and drag the app to Applications folder.
If you see "app damaged" error, right-click the app → Open → confirm Open.
Or run: `xattr -cr "/Applications/Emerald Legacy Launcher.app"`
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload macOS DMGs to release
if: matrix.platform == 'macos-latest'
uses: softprops/action-gh-release@v2
with:
files: |
src-tauri/target/release/bundle/dmg/*.dmg
src-tauri/target/release/bundle/macos/*.pkg
tag_name: v${{ steps.get_version.outputs.VERSION }}
name: 'Emerald v${{ steps.get_version.outputs.VERSION }}'
body: |
# Emerald Legacy Launcher v${{ steps.get_version.outputs.VERSION }}
## 📥 What to download?
### 🐧 GNU/Linux
- **RHEL/Fedora**: `Emerald.Legacy.Launcher-*.rpm`
- **Debian/Ubuntu**: `Emerald.Legacy.Launcher-*.deb`
- **Universal**: `Emerald.Legacy.Launcher-*.AppImage`
- **Flatpak**: `io.github.Emerald_Legacy_Launcher.Emerald_Legacy_Launcher.flatpak`
### 🍎 macOS
- **Intel Mac**: `Emerald.Legacy.Launcher_*.x64.dmg`
- **M-series Mac**: `Emerald.Legacy.Launcher_*.aarch64.dmg`
### 🪟 Windows
- **Setup Installer**: `Emerald.Legacy.Launcher-*.exe`
- **MSI Installer**: `Emerald.Legacy.Launcher-*.msi`
---
## ⚠️ Windows SmartScreen
This software is completely safe. Because the launcher is unsigned, you will see a "Windows protected your PC" window. To proceed:
1. Click the **"More info"** link under the main text.
2. Click the **"Run anyway"** button that appears.
## 🍎 macOS Installation
Download the DMG file, open it, and drag the app to Applications folder.
If you see "app damaged" error, right-click the app → Open → confirm Open.
Or run: `xattr -cr "/Applications/Emerald Legacy Launcher.app"`
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-flatpak:
runs-on: ubuntu-latest
permissions:
contents: write
needs: publish-tauri
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y flatpak flatpak-builder
- name: setup flathub
run: |
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install -y flathub org.gnome.Sdk//48 org.gnome.Platform//48 org.freedesktop.Sdk.Extension.node20//24.08 org.freedesktop.Sdk.Extension.rust-stable//24.08
sudo flatpak update
- name: setup flatpak
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: io.github.Emerald_Legacy_Launcher.Emerald_Legacy_Launcher.flatpak
manifest-path: flatpak/io.github.Emerald_Legacy_Launcher.Emerald_Legacy_Launcher.yml
cache-key: flatpak-builder-${{ github.sha }}
build-bundle: true
repository-url: https://flathub.org/repo/flathub.flatpakrepo
repository-name: flathub
- uses: softprops/action-gh-release@v2
with:
files: io.github.Emerald_Legacy_Launcher.Emerald_Legacy_Launcher.flatpak
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}