LCE-Emerald-Launcher/.github/workflows/publish.yml
2026-05-27 22:01:28 +03:00

131 lines
4.1 KiB
YAML

name: "publish"
on:
workflow_dispatch:
jobs:
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
- id: version
run: echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
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: 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: Create PKG with post-install script
if: matrix.platform == 'macos-latest'
run: |
# Create temporary directory for PKG creation
mkdir -p pkg_temp/scripts
cp scripts/postinstall.sh pkg_temp/scripts/
# Build the app first
pnpm tauri build -- ${{ matrix.args }}
# Find the built app
APP_PATH=$(find src-tauri/target/release/bundle/macos/ -name "*.app" | head -1)
APP_NAME=$(basename "$APP_PATH")
# Create PKG with post-install script
pkgbuild --root "$APP_PATH/.." \
--install-location /Applications \
--scripts pkg_temp/scripts \
--identifier "com.emerald.legacy" \
--version "1.3.0" \
--install-location "/Applications" \
--root "$APP_PATH" \
"Emerald-Legacy-Launcher.pkg"
# Move PKG to bundle directory
mkdir -p src-tauri/target/release/bundle/macos/
mv "Emerald-Legacy-Launcher.pkg" src-tauri/target/release/bundle/macos/
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
uploadPlainBinary: true
tagName: v__VERSION__
releaseName: "v__VERSION__"
releaseBody: |
# PLACEHOLDER. CHANGE ME
releaseDraft: true
prerelease: false
uploadUpdaterJson: true
args: ${{ matrix.args }}
publish-flatpak:
needs: get-version
runs-on: ubuntu-latest
permissions:
contents: write
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08
options: --privileged
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: sleep for 10 seconds
run: sleep 10
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: emerald.flatpak
manifest-path: flatpak/io.github.Emerald_Legacy_Launcher.Emerald_Legacy_Launcher.yml
cache-key: flatpak-builder-${{ github.sha }}
- uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.get-version.outputs.version }}
files: emerald.flatpak
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}