Files
desktop-apps/macos/fastlane/Fastfile
Semyon Bezrukov 8be8365d60 Fix bug 77116 - Fix mac license (#471)
Co-authored-by: Semyon Bezrukov <semen.bezrukov@onlyoffice.com>
Co-committed-by: Semyon Bezrukov <semen.bezrukov@onlyoffice.com>
2025-10-02 12:16:10 +00:00

124 lines
3.7 KiB
Ruby

# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "2.3.1"
fastlane_require 'dotenv'
Dotenv.load '.env.secret'
default_platform :mac
platform :mac do
lane :common_release do |options|
build = "build"
scheme = options[:scheme]
app_name = "ONLYOFFICE"
app = "#{build}/#{app_name}.app"
git_suffix = options[:git_suffix]
edition = options[:edition]
desc 'Cleanup'
sh("rm -rf ../#{build} && rm -rf ../Vendor/ONLYOFFICE")
desc 'Get the version from plist'
version_number = get_info_plist_value(
path: "ONLYOFFICE/Resources/#{scheme}/Info.plist",
key: "CFBundleShortVersionString"
)
build_number = get_info_plist_value(
path: "ONLYOFFICE/Resources/#{scheme}/Info.plist",
key: "CFBundleVersion"
)
app_build_number = get_info_plist_value(
path: "ONLYOFFICE/Resources/#{scheme}/Info.plist",
key: "ASCBundleBuildNumber"
)
package_name = app_name
if edition && !edition.empty? then package_name += "-#{edition}" end
package_name += "-#{git_suffix}-#{version_number}-#{app_build_number}"
if edition != "Enterprise"
sh("mkdir -p ../Vendor/ONLYOFFICE/license && cp -fv ../../common/package/license/opensource/LICENSE.html ../Vendor/ONLYOFFICE/license/LICENSE.html")
else
sh("mkdir -p ../Vendor/ONLYOFFICE/license && cp -fv ../../common/package/license/commercial/LICENSE.html ../Vendor/ONLYOFFICE/license/EULA.html")
end
desc 'Build for developer id and notarize'
gym(
scheme: scheme,
configuration: 'Release',
clean: true,
output_directory: build,
codesigning_identity: ENV["CODESIGNING_IDENTITY"],
export_method: 'developer-id',
xcargs: "URL_WEBAPPS_HELP=https://download.onlyoffice.com/install/desktop/editors/help/v7.2.0-1/apps",
skip_package_pkg: true
)
notarize(
package: app,
print_log: true,
# verbose: true
)
desc 'Prepare zip for delta update'
sh("ditto -c -k --sequesterRsrc --keepParent #{ENV['PWD']}/#{app} #{ENV['PWD']}/#{build}/#{scheme}-#{version_number}.zip")
desc 'Create DMG image'
sh("npm install appdmg")
sh("npx appdmg resources/appdmg.json ../#{build}/#{package_name}.dmg")
if options[:skip_git_bump]
next
end
desc 'Creates a bump version commit'
commit_version_bump(
message: "[macos] Version bumped to v#{version_number}(#{build_number})-#{git_suffix}",
force: true
)
desc 'Create a local tag with the new version'
add_git_tag(
tag: "macos/v#{version_number}-#{build_number}-#{git_suffix}",
build_number: build_number
)
# push changes
push_to_git_remote
end
# arm64 only
lane :release_arm do |options|
desc 'Build Apple Silicone version'
common_release(options.merge({ scheme: "ONLYOFFICE-arm", git_suffix: "arm" } ))
end
# x86_64 only
lane :release_x86_64 do |options|
desc 'Build Intel version'
common_release(options.merge( { scheme: "ONLYOFFICE-x86_64", git_suffix: "x86_64" } ))
end
# x86_64 only with v8
lane :release_v8 do |options|
desc 'Build Intel version with v8 engine'
common_release(options.merge( { scheme: "ONLYOFFICE-v8", git_suffix: "v8" } ))
end
end