Skip to content

Commit

Permalink
ci: Fix release workflow (#1782)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrezza authored Apr 8, 2024
1 parent f1311ee commit 872337a
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 39 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ gem 'jazzy', '~> 0.14.4'
# Development
gem 'xcpretty'
gem 'rake'
gem 'plist'
30 changes: 11 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,25 @@ GEM
specs:
CFPropertyList (3.0.6)
rexml
activesupport (7.1.0)
base64
bigdecimal
activesupport (6.1.7.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.1.1)
bigdecimal (3.1.4)
claide (1.1.0)
cocoapods (1.13.0)
cocoapods (1.15.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.13.0)
cocoapods-core (= 1.15.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.6.0, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
Expand All @@ -40,7 +34,7 @@ GEM
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.13.0)
cocoapods-core (1.15.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
Expand All @@ -51,7 +45,7 @@ GEM
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.6.3)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
Expand All @@ -61,9 +55,6 @@ GEM
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
drb (2.1.1)
ruby2_keywords
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
Expand All @@ -90,18 +81,17 @@ GEM
minitest (5.20.0)
molinillo (0.8.0)
mustache (1.1.1)
mutex_m (0.1.2)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
open4 (1.3.4)
plist (3.7.1)
public_suffix (4.0.7)
rake (13.0.6)
redcarpet (3.6.0)
rexml (3.2.6)
rouge (2.0.7)
ruby-macho (2.5.1)
ruby2_keywords (0.0.5)
sassc (2.4.0)
ffi (~> 1.9)
sqlite3 (1.6.6)
Expand All @@ -121,14 +111,16 @@ GEM
rexml (~> 3.2.4)
xcpretty (0.3.0)
rouge (~> 2.0.7)
zeitwerk (2.6.13)

PLATFORMS
ruby

DEPENDENCIES
jazzy (~> 0.14.4)
plist
rake
xcpretty

BUNDLED WITH
2.1.4
2.4.22
96 changes: 76 additions & 20 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,72 @@

require_relative 'Vendor/xctoolchain/Scripts/xctask/build_task'

script_folder = File.expand_path(File.dirname(__FILE__))
build_folder = File.join(script_folder, 'build')
starters_folder = File.join(script_folder, 'ParseStarterProject')
SCRIPT_PATH = File.expand_path(File.dirname(__FILE__))
starters_path = File.join(SCRIPT_PATH, 'ParseStarterProject')

ios_simulator = 'platform="iOS Simulator",name="iPhone 14"'
tvos_simulator = 'platform="tvOS Simulator",name="Apple TV"'
watchos_simulator = 'platform="watchOS Simulator",name="Apple Watch Series 8 (45mm)"'

build_action = [XCTask::BuildAction::CLEAN, XCTask::BuildAction::BUILD];

module Constants
require 'plist'

PARSE_CONSTANT_PATH = File.join(SCRIPT_PATH, 'Parse', 'Parse', 'Source/PFConstants.h')
PLISTS = [
File.join(SCRIPT_PATH, 'Parse', 'Parse', 'Resources', 'Parse-iOS.Info.plist'),
File.join(SCRIPT_PATH, 'Parse', 'Parse', 'Resources', 'Parse-OSX.Info.plist'),
File.join(SCRIPT_PATH, 'Parse', 'Parse', 'Resources', 'Parse-watchOS.Info.plist'),
File.join(SCRIPT_PATH, 'Parse', 'Parse', 'Resources', 'Parse-tvOS.Info.plist'),
File.join(SCRIPT_PATH, 'ParseUI', 'ParseUI', 'Resources', 'Info-iOS.plist'),
File.join(SCRIPT_PATH, 'ParseLiveQuery', 'ParseLiveQuery', 'Resources', 'Info.plist'),
File.join(SCRIPT_PATH, 'ParseLiveQuery', 'ParseLiveQuery-tvOS', 'Info.plist'),
File.join(SCRIPT_PATH, 'ParseLiveQuery', 'ParseLiveQuery-watchOS', 'Info.plist'),
File.join(SCRIPT_PATH, 'ParseStarterProject', 'iOS', 'ParseStarterProject', 'Resources', 'Info.plist'),
File.join(SCRIPT_PATH, 'ParseStarterProject', 'iOS', 'ParseStarterProject-Swift', 'Resources', 'Info.plist'),
File.join(SCRIPT_PATH, 'ParseStarterProject', 'OSX', 'ParseOSXStarterProject', 'Resources', 'Info.plist'),
File.join(SCRIPT_PATH, 'ParseStarterProject', 'OSX', 'ParseOSXStarterProject-Swift', 'Resources', 'Info.plist'),
File.join(SCRIPT_PATH, 'ParseStarterProject', 'tvOS', 'ParseStarterProject-Swift', 'ParseStarter', 'Info.plist'),
File.join(SCRIPT_PATH, 'ParseStarterProject', 'watchOS', 'ParseStarterProject-Swift', 'ParseStarter', 'Info.plist'),
File.join(SCRIPT_PATH, 'ParseStarterProject', 'watchOS', 'ParseStarterProject-Swift', 'ParseStarter Extension', 'Info.plist'),
File.join(SCRIPT_PATH, 'ParseStarterProject', 'watchOS', 'ParseStarterProject-Swift', 'Resources', 'Info.plist'),
]

def self.current_version
constants_file = File.open(PARSE_CONSTANT_PATH, 'r').read
matches = constants_file.match(/(.*PARSE_VERSION\s*@")(.*)(")/)
matches[2] # Return the second match, which is the version itself
end

def self.update_version(version)
constants_file = File.open(PARSE_CONSTANT_PATH, 'r+')
constants = constants_file.read
constants.gsub!(/(.*PARSE_VERSION\s*@")(.*)(")/, "\\1#{version}\\3")

constants_file.seek(0)
constants_file.write(constants)

PLISTS.each do |plist|
update_info_plist_version(plist, version)
end
end

def self.update_info_plist_version(plist_path, version)
info_plist = Plist.parse_xml(plist_path)
info_plist['CFBundleShortVersionString'] = version
info_plist['CFBundleVersion'] = version
File.open(plist_path, 'w') { |f| f.write(info_plist.to_plist) }
end
end

namespace :package do
task :set_version, [:version] do |_, args|
version = args[:version] || Constants.current_version
Constants.update_version(version)
end
end

namespace :build do
namespace :ios_starters do
task :all do
Expand All @@ -28,9 +84,9 @@ namespace :build do

task :objc do
project = 'ParseStarterProject'
ios_starters_folder = File.join(starters_folder, 'iOS', project)
ios_starters_path = File.join(starters_path, 'iOS', project)
task = XCTask::BuildTask.new do |t|
t.directory = ios_starters_folder
t.directory = ios_starters_path
t.project = "#{project}.xcodeproj"
t.scheme = project
t.configuration = 'Debug'
Expand All @@ -47,9 +103,9 @@ namespace :build do

task :swift do
project = 'ParseStarterProject-Swift'
ios_starters_folder = File.join(starters_folder, 'iOS', project)
ios_starters_path = File.join(starters_path, 'iOS', project)
task = XCTask::BuildTask.new do |t|
t.directory = ios_starters_folder
t.directory = ios_starters_path
t.project = "#{project}.xcodeproj"
t.scheme = project
t.configuration = 'Debug'
Expand All @@ -72,7 +128,7 @@ namespace :build do
end

task :objc do
macos_starter_folder = File.join(starters_folder, 'OSX', 'ParseOSXStarterProject')
macos_starter_folder = File.join(starters_path, 'OSX', 'ParseOSXStarterProject')
task = XCTask::BuildTask.new do |t|
t.directory = macos_starter_folder
t.project = 'ParseOSXStarterProject.xcodeproj'
Expand All @@ -89,7 +145,7 @@ namespace :build do
end

task :swift do
macos_starter_folder = File.join(starters_folder, 'OSX', 'ParseOSXStarterProject-Swift')
macos_starter_folder = File.join(starters_path, 'OSX', 'ParseOSXStarterProject-Swift')
task = XCTask::BuildTask.new do |t|
t.directory = macos_starter_folder
t.project = 'ParseOSXStarterProject-Swift.xcodeproj'
Expand All @@ -114,7 +170,7 @@ namespace :build do
end

task :swift do
tvos_starter_folder = File.join(starters_folder, 'tvOS', 'ParseStarterProject-Swift')
tvos_starter_folder = File.join(starters_path, 'tvOS', 'ParseStarterProject-Swift')
task = XCTask::BuildTask.new do |t|
t.directory = tvos_starter_folder
t.project = 'ParseStarter-Swift.xcodeproj'
Expand All @@ -139,7 +195,7 @@ namespace :build do
end

task :swift do
watchos_starter_folder = File.join(starters_folder, 'watchOS', 'ParseStarterProject-Swift')
watchos_starter_folder = File.join(starters_path, 'watchOS', 'ParseStarterProject-Swift')
task = XCTask::BuildTask.new do |t|
t.directory = watchos_starter_folder
t.project = 'ParseStarter-Swift.xcodeproj'
Expand Down Expand Up @@ -169,7 +225,7 @@ namespace :test do
desc 'Run iOS Tests'
task :ios do |_, args|
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.directory = SCRIPT_PATH
t.workspace = 'Parse.xcworkspace'
t.scheme = 'Parse-iOS'
t.sdk = 'iphonesimulator'
Expand All @@ -187,7 +243,7 @@ namespace :test do
desc 'Run macOS Tests'
task :macos do |_, args|
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.directory = SCRIPT_PATH
t.workspace = 'Parse.xcworkspace'
t.scheme = 'Parse-macOS'
t.sdk = 'macosx'
Expand All @@ -210,7 +266,7 @@ namespace :test do

task :framework do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.directory = SCRIPT_PATH
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseUI'
t.sdk = 'iphonesimulator'
Expand All @@ -227,7 +283,7 @@ namespace :test do

task :demo_objc do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.directory = SCRIPT_PATH
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseUIDemo'
t.sdk = 'iphonesimulator'
Expand All @@ -244,7 +300,7 @@ namespace :test do

task :demo_swift do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.directory = SCRIPT_PATH
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseUIDemo-Swift'
t.sdk = 'iphonesimulator'
Expand All @@ -270,7 +326,7 @@ namespace :test do

task :ios do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.directory = SCRIPT_PATH
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseLiveQuery-iOS'
t.sdk = 'iphonesimulator'
Expand All @@ -287,7 +343,7 @@ namespace :test do

task :tvos do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.directory = SCRIPT_PATH
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseLiveQuery-tvOS'
t.destinations = [tvos_simulator]
Expand All @@ -303,7 +359,7 @@ namespace :test do

task :watchos do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.directory = SCRIPT_PATH
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseLiveQuery-watchOS'
t.destinations = [watchos_simulator]
Expand All @@ -319,7 +375,7 @@ namespace :test do

task :osx do
task = XCTask::BuildTask.new do |t|
t.directory = script_folder
t.directory = SCRIPT_PATH
t.workspace = 'Parse.xcworkspace'
t.scheme = 'ParseLiveQuery-OSX'
t.configuration = 'Debug'
Expand Down

0 comments on commit 872337a

Please sign in to comment.