diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index e6562ce..bd20a3d 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -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 '\n\n\n\n CFBundleExecutable\n emerald-legacy-launcher\n CFBundleIdentifier\n com.emerald.legacy\n CFBundleName\n Emerald Legacy Launcher\n CFBundleVersion\n 1.0.0\n CFBundleShortVersionString\n 1.0.0\n CFBundlePackageType\n APPL\n NSHighResolutionCapable\n \n LSApplicationCategoryType\n public.app-category.games\n\n\n' > "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Emerald Legacy Launcher.app/Contents/Info.plist"
+ printf '\n\n\n\n CFBundleExecutable\n emerald-legacy-launcher\n CFBundleIdentifier\n com.emerald.legacy\n CFBundleName\n Emerald Legacy Launcher\n CFBundleVersion\n ${{ steps.get_version.outputs.VERSION }}\n CFBundleShortVersionString\n ${{ steps.get_version.outputs.VERSION }}\n CFBundlePackageType\n APPL\n NSHighResolutionCapable\n \n LSApplicationCategoryType\n public.app-category.games\n\n\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?