param( [Parameter(Mandatory=$true)] [string]$BundleName, [Parameter(Mandatory=$true)] [string]$PublishDir, [Parameter(Mandatory=$true)] [string]$Version, [Parameter(Mandatory=$true)] [string]$GitHubSha ) # Setup paths $appName = "$BundleName.app" $appDir = Join-Path "bundle-macos-app-staging" $appName $contentsDir = Join-Path $appDir "Contents" $macosDir = Join-Path $contentsDir "MacOS" $resourcesDir = Join-Path $contentsDir "Resources" # Create the macOS .app bundle directory structure New-Item -ItemType Directory -Path $macosDir -Force New-Item -ItemType Directory -Path $resourcesDir -Force # Copy icon into the .app's Resources folder Copy-Item -Path "favicon.icns" -Destination (Join-Path $resourcesDir "AppIcon.icns") -Force # Generate Info.plist metadata file with app information $plistContent = @" CFBundleDisplayName $BundleName CFBundleName $BundleName CFBundleExecutable $BundleName NSHumanReadableCopyright © Oleksii Holub CFBundleIdentifier me.Tyrrrz.$BundleName CFBundleSpokenName Discord Chat Exporter CFBundleIconFile AppIcon CFBundleIconName AppIcon CFBundleVersion $GitHubSha CFBundleShortVersionString $Version NSHighResolutionCapable CFBundlePackageType APPL "@ Set-Content -Path (Join-Path $contentsDir "Info.plist") -Value $plistContent # Move all files from the publish directory into the MacOS directory Get-ChildItem -Path $PublishDir | ForEach-Object { Move-Item -Path $_.FullName -Destination $macosDir -Force } # Move the final .app bundle into the publish directory for upload Move-Item -Path $appDir -Destination $PublishDir -Force