Improve release process

- remove towncrier logs from PR builds and move them to github releases
- set build version based on current time
- bump app version
This commit is contained in:
Stefan Ceriu
2022-07-22 16:23:50 +03:00
committed by Stefan Ceriu
parent 801a3fe508
commit e27e66f22b
5 changed files with 39 additions and 24 deletions

View File

@@ -81,18 +81,10 @@ jobs:
DIAWI_API_TOKEN: ${{ secrets.DIAWI_API_TOKEN }}
GITHUB_PR_NUMBER: ${{ github.event.number }}
- name: Read version_changes.md
id: read_changes
uses: juliangruber/read-file-action@v1
with:
path: ./version_changes.md
- name: Add release notes and Diawi info
uses: NejcZdovc/comment-pr@v1
with:
message: |
${{ steps.read_changes.outputs.content }}
:iphone: Scan the QR code below to install the build for this PR.
:lock: This build is for internal testing purpose. Only devices listed in the ad-hoc provisioning profile can install Element Alpha.

View File

@@ -2367,7 +2367,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = io.element.elementx;
PRODUCT_NAME = ElementX;
SDKROOT = iphoneos;
@@ -2389,7 +2389,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = io.element.elementx;
PRODUCT_NAME = ElementX;
SDKROOT = iphoneos;

View File

@@ -51,7 +51,7 @@ targets:
base:
PRODUCT_NAME: ElementX
PRODUCT_BUNDLE_IDENTIFIER: io.element.elementx
MARKETING_VERSION: 1.0.1
MARKETING_VERSION: 1.0.2
CURRENT_PROJECT_VERSION: 1
DEVELOPMENT_TEAM: 7J4U792NQT
CODE_SIGN_ENTITLEMENTS: ElementX/SupportingFiles/ElementX.entitlements

View File

@@ -42,8 +42,6 @@ lane :alpha do
upload_to_diawi()
export_version_changes(version: version)
end
lane :build_and_publish_on_github do
@@ -99,13 +97,6 @@ lane :tests do
end
private_lane :export_version_changes do |options|
Dir.chdir("..") do
sh("sed -i '.tmp' 's/CHANGES.md/version_changes.md/g' towncrier.toml")
Changelog.update_topmost_section(version: options[:version], additional_entries: {})
end
end
private_lane :config_xcodegen_alpha do
target_file_path = "../ElementX/SupportingFiles/target.yml"
data = YAML.load_file target_file_path
@@ -151,20 +142,33 @@ private_lane :release_to_github do
diawi_app_id = URI(diawi_link).path.split('/').last
diawi_qr_code_link = "https://www.diawi.com/qrcode/link/#{diawi_app_id}"
release_version = "#{get_version_number()}-#{Time.now.strftime("%Y%m%d%H%M")}"
# Increment build number to current date
build_number = Time.now.strftime("%Y%m%d%H%M")
increment_build_number(build_number: build_number)
release_version = get_version_number()
changes = export_version_changes(version: release_version)
github_release = set_github_release(
repository_name: "vector-im/element-x-ios",
api_token: api_token,
name: release_version,
tag_name: release_version,
is_generate_release_notes: true,
is_generate_release_notes: false,
description: "[iOS AdHoc Release - Diawi Link](#{diawi_link})
![QR code](#{diawi_qr_code_link})",
# upload_assets: ["build/ElementX.app.zip"]
![QR code](#{diawi_qr_code_link})
#{changes}"
)
end
private_lane :export_version_changes do |options|
Dir.chdir("..") do
# Changelog.update_topmost_section(version: options[:version], additional_entries: {})
Changelog.extract_first_section
end
end
private_lane :update_app_icon do |options|
caption_text = options[:caption_text]
UI.user_error!("Invalid caption text.") unless !caption_text.to_s.empty?

View File

@@ -11,6 +11,8 @@ require "date"
# Helper methods to handle updates of the Changelog file
#
module Changelog
CHANGES_SEPARATOR_REGEX = /^\#\#\ Changes/.freeze
FILE = "CHANGES.md"
# Update the topmost section of the changelog to put version+date in title + add entry for dependency updates
#
@@ -40,5 +42,22 @@ module Changelog
# Let towncrier update the change
system("towncrier", "build", "--version", "#{version}", "--yes")
end
# Returns the first section of the Changelog, corresponding to the changes in the latest version
#
def self.extract_first_section
lines = []
File.open(FILE, "r") do |file|
section_index = 0
file.each_line do |line|
is_separator_line = (line.chomp =~ CHANGES_SEPARATOR_REGEX)
section_index += 1 if is_separator_line
break if section_index >= 2
lines.append(line) if section_index == 1
end
end
lines[0..-2].join # Remove last line (title of section 2)
end
end