Skip to content

Commit

Permalink
chore: implement beta release
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
  • Loading branch information
pylapp committed Jul 18, 2024
1 parent 4350d86 commit 6283355
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- [Showcase] Distribute demo app development version ([#12](https://github.com/Orange-OpenSource/ouds-ios/issues/12))
- [Showcase] Distribute demo app for feature validation ([#13](https://github.com/Orange-OpenSource/ouds-ios/issues/13))
- [Library] Define Swift Package library for OUDS ([#46](https://github.com/Orange-OpenSource/ouds-ios/issues/46))
- [Showcase] Create the basic architecture of the demo application ([#6](https://github.com/Orange-OpenSource/ouds-ios/issues/6))
Expand Down
4 changes: 2 additions & 2 deletions Showcase/Showcase.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 00;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_ASSET_PATHS = "\"Showcase/Preview Content\"";
DEVELOPMENT_TEAM = MG2LSJNJB6;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -586,7 +586,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 00;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_ASSET_PATHS = "\"Showcase/Preview Content\"";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = MG2LSJNJB6;
Expand Down
43 changes: 25 additions & 18 deletions Showcase/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ platform :ios do
build
if params[:upload]
puts "Upload to TestFlight requested"
upload
upload(type: "prod")
else
puts "Upload to TestFlight not requested"
end
Expand All @@ -227,7 +227,7 @@ platform :ios do
puts "👉 Build and upload (alpha)"
update_build_number
build
upload
upload(type: "alpha")

else # Beta case (not production too), detailSymbol should be here commit hash
detailSymbol = params[:detailSymbol]
Expand All @@ -241,21 +241,21 @@ platform :ios do
update_build_number
build
else
puts "Nothing new to build today, a CI tag for commit '#{detailSymbol}' already exists"
puts "ℹ️ Nothing new to build today, a CI tag for commit '#{detailSymbol}' already exists"
publish_mattermost_notification("⚙️ 🤔 Nothing new to build today, a CI tag for commit '#{detailSymbol}' already exists")
end

if params[:upload]
puts "Upload to TestFlight requested"
puts "ℹ️ Upload to TestFlight requested"
# If already uploaded, prevents to upload again
if tag_testflight_upload(detailSymbol)
upload
upload(type: "beta")
else
puts "Nothing new to build today, a TestFlight tag for commit '#{detailSymbol}' already exists"
puts "ℹ️ Nothing new to build today, a TestFlight tag for commit '#{detailSymbol}' already exists"
publish_mattermost_notification("⚙️ 🤔 Nothing new to build today, a TestFlight tag for commit '#{detailSymbol}' already exists")
end
else
puts "Upload to TestFlight not requested"
puts "ℹ️ Upload to TestFlight not requested"
end

end
Expand Down Expand Up @@ -302,7 +302,6 @@ platform :ios do
# Needed for upload later as .xcarchive for App Store through corporate portal
zip(path: "build/oudsApp.xcarchive",
output_path: "build/oudsApp.zip")


version = get_app_version
build_number = get_build_number(xcodeproj: OUDS_PROJECT)
Expand All @@ -318,7 +317,7 @@ platform :ios do
# PRIVATE LANE UPLOAD TO TESTFLIGHT (ALPHA / BETA / PROD is set by main lane)
# ---------------------------------------------------------------------------
desc "PRIVATE LANE UPLOAD TO TESTFLIGHT"
private_lane :upload do
private_lane :upload do |params|
puts "👉 Upload"

begin
Expand All @@ -340,6 +339,14 @@ platform :ios do

news = read_current_release_notes

uploadType = params[:type]
if uploadType != nil && uploadType.to_s.empty == false
puts "ℹ️ Upload type: '#{uploadType}'"
news = "Warning: this is #{uploadType} build\n\n" + news # Add details about build type in changelog for TestFlight
else
puts "ℹ️ Upload type seems to be production"
end

upload_to_testflight(
changelog: news,
app_identifier: "#{DEVELOPER_APP_IDENTIFIER}",
Expand Down Expand Up @@ -368,7 +375,7 @@ platform :ios do

begin
if commitHash.nil? || commitHash.empty?
puts "No parameter sent for CI tag, nothing will be done"
puts "ℹ️ No parameter sent for CI tag, nothing will be done"
publish_mattermost_notification("⚙️ 🤔 No commit hash has been given, no tag can be created")
return false
else
Expand All @@ -392,7 +399,7 @@ platform :ios do

begin
if commitHash.nil? || commitHash.empty?
puts "No parameter sent for CI tag, nothing will be done"
puts "ℹ️ No parameter sent for CI tag, nothing will be done"
publish_mattermost_notification("⚙️ 🤔 No commit hash has been given, no tag can be created")
return false
else
Expand All @@ -416,19 +423,19 @@ platform :ios do

# Check personal access token for tag creation
if GITHUB_ACCESS_TOKEN.nil? || GITHUB_ACCESS_TOKEN.empty?
puts "Error: No GitHub access token defined, cannot create and push tags"
puts "Error: No GitHub access token defined, cannot create and push tags"
publish_mattermost_notification("⚙️ 😰 @channel No GitHub access token defined, cannot create and push tags!")
return false
else
# Check if given tag exists yet
puts "Check if '#{tag}' exists yet"
puts "ℹ️ Check if '#{tag}' exists yet"
result=sh("curl -s 'https://api.github.com/repos/Orange-OpenSource/ouds-ios/git/refs/tags/#{tag}' | jq -r '.ref'") # TODO Shell error management
# If tag exists, CURL response is formatted like "refs/tags/tag"
if "refs/tags/#{tag}".eql? result.strip # Removes line break available in command result
puts "The tag '#{tag}' still exists, won't create new tag"
puts "ℹ️ The tag '#{tag}' still exists, won't create new tag"
return false
else
puts "Commit SHA to tag is '#{IOS_APP_COMMIT_SHA}'"
puts "ℹ️ Commit SHA to tag is '#{IOS_APP_COMMIT_SHA}'"
# Just a light tag is enough
sh("curl -L \
-X POST \
Expand Down Expand Up @@ -465,19 +472,19 @@ platform :ios do
def read_current_release_notes
version = get_app_version

changelog=read_changelog(
changelog = read_changelog(
changelog_path: '../CHANGELOG.md',
section_identifier: "[#{version}]",
)

if changelog == ""
changelog=read_changelog(
changelog = read_changelog(
changelog_path: '../CHANGELOG.md',
section_identifier: "[Unreleased]",
)
end

puts "Current relase notes = #{changelog}"
puts "ℹ️ Current relase notes = #{changelog}"
return changelog
end
end
13 changes: 12 additions & 1 deletion docs_release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ This file lists all the steps to follow when releasing a new version of OUDS iOS
* [GitHub download Shell script](#github-download-shell-script)
- [How it works](#how-it-works)
* [Alpha builds](#alpha-builds)

* [Beta builds](#beta-builds)

## Prepare release

- Create a branch named `prepare-release` to prepare the new release for OUDS iOS version X.Y.Z.
Expand Down Expand Up @@ -571,3 +572,13 @@ The *alpha* build then will be uploaded <a href="./images/build-alpha-TestFlight
Both our <a href="./images/build-alpha-Mattermost-details.png">_Mattermost_ hook</a> and the _Fastlane_ lanes produce details about the build like <a href="./images/build-alpha-GitLabCI-meta_details.png">version, issues</a> and <a href="./images/build-alpha-GitLabCI-build_number.png">build number</a>.

There are also in the app <a href="./images/build-alpha-in_app.jpeg">some extra fields</a> defined in the app _Info.plist_ through _Fastlane_ and _GitLab CI_ showing the app version, its build number, the build type (DEBUG for local builds, ALPHA for alpha release, BETA for beta release, PROD for production release) and the build details (issues numbers). The <a href="./images/build-alpha-display_name.jpeg">display name</a> will be modified too.

### Beta builds

The *beta* builds are created with a scheduled pipeline.
This is quite the same logic as *alpha builds*, but with Git tags associated to the builds on *develop* branch (one for the build prefixed by *ci/*, one for TestFlight upload prefixed by *Test_Flight*) with commit hash as suffix.

The *beta* build is automatically uploaded to _TestFlight_ for a dedicated team (here *beta-team*).

The *Mattermsot* hook is also used, the app display name and the build details are updated too.

0 comments on commit 6283355

Please sign in to comment.