Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PBIOS-193] 📱 Add process for triggering and numbering Appcenter builds #184

Merged
merged 17 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@ def steps = [
runNode {
getReleaseNotes()
def args = "type:${buildType()}"
// prepareToBuild(buildType())

buildAndShipiOS(args)
}
// }, 'macOS': {
// runNode {
// buildAndShipMacOS(args)
// }
}
]
def map = steps
Expand All @@ -31,6 +27,7 @@ parallel map

waitUntil { success }

// This doesn't setup any of the Github/Runway data!
runShortNode {
stage('Runway Comment') {
writeRunwayComment()
Expand Down Expand Up @@ -67,6 +64,7 @@ def runShortNode(block) {
}

def checkForFailedParallelJob() {
echo "Checking for failed parallel job..."
if (success == false) {
throw new Exception('A parallel job has failed.')
}
Expand All @@ -84,7 +82,9 @@ def runNodeWith(label, block, isShort) {
stage('Checkout') {
checkout scm
}

stage('Update Build Number') {
sh "echo \"CURRENT_PROJECT_VERSION = ${buildNumber}\" > ./PlaybookShowcase/Versioning.xcconfig"
}
if (isShort == false) {
stage('Dependencies') {
sh 'make dependencies'
Expand Down
6 changes: 6 additions & 0 deletions PlaybookShowcase/PlaybookShowcase.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/* Begin PBXBuildFile section */
639039872A13A496004576FF /* ContentListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 639039862A13A496004576FF /* ContentListView.swift */; };
8F6D944E2AE98ED800AF0D15 /* Versioning.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 8F6D944D2AE98ED800AF0D15 /* Versioning.xcconfig */; };
8F6D944F2AE98ED800AF0D15 /* Versioning.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 8F6D944D2AE98ED800AF0D15 /* Versioning.xcconfig */; };
F905151B29F03B0700F9B66D /* PlaybookShowcaseApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F905151A29F03B0700F9B66D /* PlaybookShowcaseApp.swift */; };
F905151F29F03B0700F9B66D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F905151E29F03B0700F9B66D /* Assets.xcassets */; };
F905152229F03B0700F9B66D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F905152129F03B0700F9B66D /* Preview Assets.xcassets */; };
Expand All @@ -21,6 +23,7 @@

/* Begin PBXFileReference section */
639039862A13A496004576FF /* ContentListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentListView.swift; sourceTree = "<group>"; };
8F6D944D2AE98ED800AF0D15 /* Versioning.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Versioning.xcconfig; sourceTree = "<group>"; };
F905151829F03B0700F9B66D /* PlaybookShowcase-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "PlaybookShowcase-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
F905151A29F03B0700F9B66D /* PlaybookShowcaseApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaybookShowcaseApp.swift; sourceTree = "<group>"; };
F905151E29F03B0700F9B66D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -82,6 +85,7 @@
F9370FC929EDCC0100FFD0DF = {
isa = PBXGroup;
children = (
8F6D944D2AE98ED800AF0D15 /* Versioning.xcconfig */,
F937100029EDCC1900FFD0DF /* Packages */,
F905151929F03B0700F9B66D /* PlaybookShowcase */,
F905154729F03B3C00F9B66D /* PlaybookShowcase-macOS */,
Expand Down Expand Up @@ -203,6 +207,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8F6D944E2AE98ED800AF0D15 /* Versioning.xcconfig in Resources */,
F905152229F03B0700F9B66D /* Preview Assets.xcassets in Resources */,
F905151F29F03B0700F9B66D /* Assets.xcassets in Resources */,
);
Expand All @@ -212,6 +217,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8F6D944F2AE98ED800AF0D15 /* Versioning.xcconfig in Resources */,
F943570A29F070F10051C650 /* Preview Assets.xcassets in Resources */,
F943570929F070E90051C650 /* Assets.xcassets in Resources */,
);
Expand Down
1 change: 1 addition & 0 deletions PlaybookShowcase/Versioning.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CURRENT_PROJECT_VERSION = 135.3
6 changes: 5 additions & 1 deletion Tools/setup-story-details.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ if [ -n "$GITHUB_PULL_REQUEST_ID" ]; then

getPullRequestDetails "$GITHUB_PULL_REQUEST_ID" \
| tee "$PR_DETAILS" \
| jq ". | {url, user, id, number, title, state, commits, mergeable}"
| jq ". | {commits, draft, id, labels, mergeable, number, state, title, url, user}"

export PR_READY_FOR_TESTING=`jq -r '.labels | map(select(.name == "Ready for Testing"))| . != []' "$PR_DETAILS"`

echo "$PR_READY_FOR_TESTING"

export PR_USER_HANDLE=`jq -r .user.login "$PR_DETAILS"`
else
Expand Down
30 changes: 25 additions & 5 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ target_ios = 'PlaybookShowcase-iOS'
build_path = "BuildTemp/Archives"
derived_data_path = "DerivedData"
ios_plist = "./Info.plist"
appcenter_token = "bf0ae509c985f2a1102c2ad53894b35a5fa5383e"

desc "Tag build"
lane :tag_build do |opts|
begin
add_git_tag(tag: "builds/#{opts[:build]}")
push_git_tags(remote: "[email protected]:powerhome/PlaybookSwift.git")
rescue => ex
UI.error(ex)
end
end

desc "Set up build. build_number:1"
lane :setup_before_build do |opts|
Expand All @@ -41,7 +52,8 @@ lane :build_ios do |opts|
output_name: "#{target_ios}.ipa",
build_path: build_path,
derived_data_path: derived_data_path,
xcargs: '-skipPackagePluginValidation'
xcargs: '-skipPackagePluginValidation',
xcconfig: './PlaybookShowcase/Versioning.xcconfig'
)
end

Expand All @@ -66,15 +78,15 @@ end

desc "Ship iOS to App Center"
lane :ship_ios_to_appcenter do |opts|

app_name = "Playbook-Showcase-Beta"
if opts[:type] == 'production'
app_name = "Playbook-Showcase"
end

opts[:os] = 'ios'
appcenter_upload(
api_token: "bf0ae509c985f2a1102c2ad53894b35a5fa5383e",
api_token: appcenter_token,
owner_name: "powerhome",
owner_type: "organization",
app_name: app_name,
Expand Down Expand Up @@ -107,10 +119,18 @@ lane :create_runway_comment do |opts|
merged_comment = "✅ MERGED ✅\n\n"
end

# https://install.appcenter.ms/orgs/powerhome/apps/#{app_name}/releases/#{release_num}
# Generate the link above based on this call:
version_info = appcenter_fetch_version_number(
api_token: appcenter_token,
owner_name: "powerhome",
app_name: app_name
)

comment = <<~HEREDOC
<p><b>#{merged_comment}#{type} build #{build_number}</b></p>
<ul>
<li>PlaybookShowcase-iOS: <a href=#{"https://install.appcenter.ms/orgs/powerhome/apps/#{app_name}"}>iOS</a></li>
<li>PlaybookShowcase-iOS: <a href=#{"https://install.appcenter.ms/orgs/powerhome/apps/#{app_name}/releases/#{version_info["id"]}"}>iOS</a></li>
</ul>
HEREDOC

Expand Down Expand Up @@ -150,4 +170,4 @@ def keep_trying(ignore=[], interval=300, retry_counter=0, &block)
end
end
nil
end
end