Update publish.yml

This commit is contained in:
Santiago Fisela 2026-03-31 16:09:53 -03:00
parent 7f5d513c46
commit 9befcea625

View file

@ -15,20 +15,27 @@ jobs:
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest'
args: '--target x86_64-apple-darwin'
# - platform: 'ubuntu-22.04'
# args: ''
# - platform: 'windows-latest'
# args: ''
- platform: 'ubuntu-22.04'
args: ''
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Extract version
id: get_version
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
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libudev-dev
- name: setup pnpm
uses: pnpm/action-setup@v4
@ -52,49 +59,25 @@ jobs:
- 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.0.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/
- name: Build and create DMG for macOS
- 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>1.0.0</string>\n <key>CFBundleShortVersionString</key>\n <string>1.0.0</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"
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/"
@ -102,11 +85,27 @@ jobs:
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'
@ -114,10 +113,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: v__VERSION__
releaseName: 'Emerald v__VERSION__'
tagName: v${{ steps.get_version.outputs.VERSION }}
releaseName: 'Emerald v${{ steps.get_version.outputs.VERSION }}'
releaseBody: |
# Emerald Legacy Launcher v__VERSION__
# Emerald Legacy Launcher v${{ steps.get_version.outputs.VERSION }}
## 📥 What to download?
@ -161,10 +160,10 @@ jobs:
src-tauri/target/release/bundle/rpm/*.rpm
src-tauri/target/release/bundle/msi/*.msi
src-tauri/target/release/bundle/nsis/*.exe
tag_name: v__VERSION__
name: 'Emerald v__VERSION__'
tag_name: v${{ steps.get_version.outputs.VERSION }}
name: 'Emerald v${{ steps.get_version.outputs.VERSION }}'
body: |
# Emerald Legacy Launcher v__VERSION__
# Emerald Legacy Launcher v${{ steps.get_version.outputs.VERSION }}
## 📥 What to download?
@ -203,11 +202,13 @@ jobs:
if: matrix.platform == 'macos-latest'
uses: softprops/action-gh-release@v2
with:
files: src-tauri/target/release/bundle/dmg/*.dmg
tag_name: v__VERSION__
name: 'Emerald v__VERSION__'
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__VERSION__
# Emerald Legacy Launcher v${{ steps.get_version.outputs.VERSION }}
## 📥 What to download?