mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
vector-im/element-x-ios/issues/11 - ElementX PR build setup
This commit is contained in:
parent
cd77a7e265
commit
a1a7cd7745
90
.github/workflows/release-alpha.yml
vendored
Normal file
90
.github/workflows/release-alpha.yml
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
name: Build alpha release
|
||||||
|
|
||||||
|
on:
|
||||||
|
|
||||||
|
# Triggers the workflow on any pull request
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-secret:
|
||||||
|
runs-on: macos-12
|
||||||
|
outputs:
|
||||||
|
out-key: ${{ steps.out-key.outputs.defined }}
|
||||||
|
steps:
|
||||||
|
- id: out-key
|
||||||
|
env:
|
||||||
|
P12_KEY: ${{ secrets.ALPHA_CERTIFICATES_P12 }}
|
||||||
|
P12_PASSWORD_KEY: ${{ secrets.ALPHA_CERTIFICATES_P12_PASSWORD }}
|
||||||
|
if: "${{ env.P12_KEY != '' || env.P12_PASSWORD_KEY != '' }}"
|
||||||
|
run: echo "::set-output name=defined::true"
|
||||||
|
build:
|
||||||
|
# Run job if secrets are available (not available for forks).
|
||||||
|
needs: [check-secret]
|
||||||
|
if: needs.check-secret.outputs.out-key == 'true'
|
||||||
|
name: Release
|
||||||
|
runs-on: macos-12
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
# Only allow a single run of this workflow on each branch, automatically cancelling older runs.
|
||||||
|
group: alpha-${{ github.head_ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Cache Ruby gems
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: vendor/bundle
|
||||||
|
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-gems-
|
||||||
|
|
||||||
|
# Common setup
|
||||||
|
- name: Brew bundle
|
||||||
|
run:
|
||||||
|
brew bundle
|
||||||
|
|
||||||
|
- name: Bundle install
|
||||||
|
run: |
|
||||||
|
bundle config path vendor/bundle
|
||||||
|
bundle install --jobs 4 --retry 3
|
||||||
|
|
||||||
|
# Import alpha release private signing certificate
|
||||||
|
- name: Import signing certificate
|
||||||
|
uses: apple-actions/import-codesign-certs@v1
|
||||||
|
with:
|
||||||
|
p12-file-base64: ${{ secrets.ALPHA_CERTIFICATES_P12 }}
|
||||||
|
p12-password: ${{ secrets.ALPHA_CERTIFICATES_P12_PASSWORD }}
|
||||||
|
|
||||||
|
# Main step
|
||||||
|
# The Ad-hoc release link will be referenced as 'DIAWI_FILE_LINK'
|
||||||
|
# and QR link as 'DIAWI_QR_CODE_LINK' when the Diawi upload succeed
|
||||||
|
- name: Build Ad-hoc release and send it to Diawi
|
||||||
|
run: bundle exec fastlane alpha
|
||||||
|
env:
|
||||||
|
# Automatically bypass 2FA upgrade if possible on Apple account.
|
||||||
|
SPACESHIP_SKIP_2FA_UPGRADE: true
|
||||||
|
APPLE_ID: ${{ secrets.FASTLANE_USER }}
|
||||||
|
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
|
||||||
|
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
|
||||||
|
DIAWI_API_TOKEN: ${{ secrets.DIAWI_API_TOKEN }}
|
||||||
|
GITHUB_PR_NUMBER: ${{ github.event.number }}
|
||||||
|
|
||||||
|
- name: Add or update PR comment with Ad-hoc release informations
|
||||||
|
uses: NejcZdovc/comment-pr@v1
|
||||||
|
with:
|
||||||
|
message: |
|
||||||
|
: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.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
If you can't scan the QR code you can install the build via this link: ${{ env.DIAWI_FILE_LINK }}
|
||||||
|
# Enables to identify and update existing Ad-hoc release message on new commit in the PR
|
||||||
|
identifier: "GITHUB_COMMENT_ADHOC_RELEASE"
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
4
Brewfile
4
Brewfile
@ -1,3 +1,5 @@
|
|||||||
brew "xcodegen"
|
brew "xcodegen"
|
||||||
brew "swiftlint"
|
|
||||||
brew "swiftgen"
|
brew "swiftgen"
|
||||||
|
brew "imagemagick"
|
||||||
|
|
||||||
|
#brew "swiftlint" # Fails on the CI: `Target /usr/local/bin/swiftlint Target /usr/local/bin/swiftlint already exists`. Installed through https://github.com/actions/virtual-environments/blob/main/images/macos/macos-12-Readme.md#linters
|
@ -35,40 +35,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"swiftlint": {
|
|
||||||
"version": "0.47.1",
|
|
||||||
"bottle": {
|
|
||||||
"rebuild": 0,
|
|
||||||
"root_url": "https://ghcr.io/v2/homebrew/core",
|
|
||||||
"files": {
|
|
||||||
"arm64_monterey": {
|
|
||||||
"cellar": ":any_skip_relocation",
|
|
||||||
"url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:13b6b6d881b6cfa3f5399c14150ef6da0f1d1cec2b58fd24c6dcbc432c462106",
|
|
||||||
"sha256": "13b6b6d881b6cfa3f5399c14150ef6da0f1d1cec2b58fd24c6dcbc432c462106"
|
|
||||||
},
|
|
||||||
"arm64_big_sur": {
|
|
||||||
"cellar": ":any_skip_relocation",
|
|
||||||
"url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:406fb7b019a5b7f0c052a7d4738f6cda5eaf15ef9c1bc1f89bdc3dc2efc719b6",
|
|
||||||
"sha256": "406fb7b019a5b7f0c052a7d4738f6cda5eaf15ef9c1bc1f89bdc3dc2efc719b6"
|
|
||||||
},
|
|
||||||
"monterey": {
|
|
||||||
"cellar": ":any_skip_relocation",
|
|
||||||
"url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:3c02d2875bef6dbd474c60a4ce42cce5f9e1da64580c00c351753adeaece5700",
|
|
||||||
"sha256": "3c02d2875bef6dbd474c60a4ce42cce5f9e1da64580c00c351753adeaece5700"
|
|
||||||
},
|
|
||||||
"big_sur": {
|
|
||||||
"cellar": ":any_skip_relocation",
|
|
||||||
"url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:775d4db3c21549bb18384be86ee82a43c92af12b74f9135e7b44f448cd6e0eff",
|
|
||||||
"sha256": "775d4db3c21549bb18384be86ee82a43c92af12b74f9135e7b44f448cd6e0eff"
|
|
||||||
},
|
|
||||||
"x86_64_linux": {
|
|
||||||
"cellar": "/home/linuxbrew/.linuxbrew/Cellar",
|
|
||||||
"url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:f00160b4eb1d370d6baf4341341f813af80ba2fcfa2e65657f96153713d1c774",
|
|
||||||
"sha256": "f00160b4eb1d370d6baf4341341f813af80ba2fcfa2e65657f96153713d1c774"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"swiftgen": {
|
"swiftgen": {
|
||||||
"version": "6.5.1",
|
"version": "6.5.1",
|
||||||
"bottle": {
|
"bottle": {
|
||||||
@ -97,18 +63,57 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"imagemagick": {
|
||||||
|
"version": "7.1.0-32",
|
||||||
|
"bottle": {
|
||||||
|
"rebuild": 0,
|
||||||
|
"root_url": "https://ghcr.io/v2/homebrew/core",
|
||||||
|
"files": {
|
||||||
|
"arm64_monterey": {
|
||||||
|
"cellar": "/opt/homebrew/Cellar",
|
||||||
|
"url": "https://ghcr.io/v2/homebrew/core/imagemagick/blobs/sha256:a000a3d98820aad5aba1d1b27967c992a680af6073d3776c5615ad85c65cfe5b",
|
||||||
|
"sha256": "a000a3d98820aad5aba1d1b27967c992a680af6073d3776c5615ad85c65cfe5b"
|
||||||
|
},
|
||||||
|
"arm64_big_sur": {
|
||||||
|
"cellar": "/opt/homebrew/Cellar",
|
||||||
|
"url": "https://ghcr.io/v2/homebrew/core/imagemagick/blobs/sha256:cd8e156ab68b436afaafee16362814886217d420ff25ebe5a026ef7f84594fb5",
|
||||||
|
"sha256": "cd8e156ab68b436afaafee16362814886217d420ff25ebe5a026ef7f84594fb5"
|
||||||
|
},
|
||||||
|
"monterey": {
|
||||||
|
"cellar": "/usr/local/Cellar",
|
||||||
|
"url": "https://ghcr.io/v2/homebrew/core/imagemagick/blobs/sha256:ca5f4b21069ba55a8721dc979c93854b4d9083b08d4d998569563f03eeabf246",
|
||||||
|
"sha256": "ca5f4b21069ba55a8721dc979c93854b4d9083b08d4d998569563f03eeabf246"
|
||||||
|
},
|
||||||
|
"big_sur": {
|
||||||
|
"cellar": "/usr/local/Cellar",
|
||||||
|
"url": "https://ghcr.io/v2/homebrew/core/imagemagick/blobs/sha256:1602ec46afbe6cd6eef61605d904db05277637de1e55a262973657d6ce48c62e",
|
||||||
|
"sha256": "1602ec46afbe6cd6eef61605d904db05277637de1e55a262973657d6ce48c62e"
|
||||||
|
},
|
||||||
|
"catalina": {
|
||||||
|
"cellar": "/usr/local/Cellar",
|
||||||
|
"url": "https://ghcr.io/v2/homebrew/core/imagemagick/blobs/sha256:cba2739bf96a77e5e7502ffb86561fcb8c546e1bdfc3ab1bed45b6feecf7030e",
|
||||||
|
"sha256": "cba2739bf96a77e5e7502ffb86561fcb8c546e1bdfc3ab1bed45b6feecf7030e"
|
||||||
|
},
|
||||||
|
"x86_64_linux": {
|
||||||
|
"cellar": "/home/linuxbrew/.linuxbrew/Cellar",
|
||||||
|
"url": "https://ghcr.io/v2/homebrew/core/imagemagick/blobs/sha256:8f3597d568169af3d0121c35407274444cb626167980a7e135d12b8867594d3a",
|
||||||
|
"sha256": "8f3597d568169af3d0121c35407274444cb626167980a7e135d12b8867594d3a"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"system": {
|
"system": {
|
||||||
"macos": {
|
"macos": {
|
||||||
"monterey": {
|
"monterey": {
|
||||||
"HOMEBREW_VERSION": "3.4.9",
|
"HOMEBREW_VERSION": "3.4.10",
|
||||||
"HOMEBREW_PREFIX": "/opt/homebrew",
|
"HOMEBREW_PREFIX": "/opt/homebrew",
|
||||||
"Homebrew/homebrew-core": "297be05c529835e0e211de450aa55836b6b1fca7",
|
"Homebrew/homebrew-core": "42c7b6d3e3d3699c34f49b91f602def69ca1ac4d",
|
||||||
"CLT": "13.0.0.0.1.1627064638",
|
"CLT": "13.0.0.0.1.1627064638",
|
||||||
"Xcode": "13.3.1",
|
"Xcode": "13.3.1",
|
||||||
"macOS": "12.2.1"
|
"macOS": "12.3.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,8 +105,11 @@ GEM
|
|||||||
xcodeproj (>= 1.13.0, < 2.0.0)
|
xcodeproj (>= 1.13.0, < 2.0.0)
|
||||||
xcpretty (~> 0.3.0)
|
xcpretty (~> 0.3.0)
|
||||||
xcpretty-travis-formatter (>= 0.0.3)
|
xcpretty-travis-formatter (>= 0.0.3)
|
||||||
|
fastlane-plugin-brew (0.1.1)
|
||||||
fastlane-plugin-diawi (2.1.0)
|
fastlane-plugin-diawi (2.1.0)
|
||||||
rest-client (>= 2.0.0)
|
rest-client (>= 2.0.0)
|
||||||
|
fastlane-plugin-xcodegen (1.1.0)
|
||||||
|
fastlane-plugin-brew (~> 0.1.1)
|
||||||
gh_inspector (1.1.3)
|
gh_inspector (1.1.3)
|
||||||
google-apis-androidpublisher_v3 (0.16.0)
|
google-apis-androidpublisher_v3 (0.16.0)
|
||||||
google-apis-core (>= 0.4, < 2.a)
|
google-apis-core (>= 0.4, < 2.a)
|
||||||
@ -235,6 +238,7 @@ PLATFORMS
|
|||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
fastlane
|
fastlane
|
||||||
fastlane-plugin-diawi
|
fastlane-plugin-diawi
|
||||||
|
fastlane-plugin-xcodegen
|
||||||
xcov
|
xcov
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
|
@ -1,3 +1,56 @@
|
|||||||
|
require 'yaml'
|
||||||
|
|
||||||
|
lane :alpha do
|
||||||
|
|
||||||
|
config_xcodegen_alpha()
|
||||||
|
|
||||||
|
xcodegen(spec: "project.yml")
|
||||||
|
|
||||||
|
provisioning_profile_name = "ElementX PR Ad Hoc"
|
||||||
|
bundle_identifier = "io.element.elementx.pr"
|
||||||
|
code_signing_identity = "Apple Distribution: Vector Creations Limited (7J4U792NQT)"
|
||||||
|
|
||||||
|
update_code_signing_settings(
|
||||||
|
use_automatic_signing: false,
|
||||||
|
bundle_identifier: bundle_identifier,
|
||||||
|
profile_name: provisioning_profile_name,
|
||||||
|
code_sign_identity: code_signing_identity
|
||||||
|
)
|
||||||
|
|
||||||
|
get_provisioning_profile(
|
||||||
|
app_identifier: bundle_identifier,
|
||||||
|
provisioning_name: provisioning_profile_name,
|
||||||
|
ignore_profiles_with_different_name: true,
|
||||||
|
adhoc: true
|
||||||
|
)
|
||||||
|
|
||||||
|
update_app_icon()
|
||||||
|
|
||||||
|
build_ios_app(
|
||||||
|
clean: true,
|
||||||
|
export_method: "ad-hoc",
|
||||||
|
output_directory: "build",
|
||||||
|
export_options: {
|
||||||
|
provisioningProfiles: {
|
||||||
|
bundle_identifier => provisioning_profile_name,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
upload_to_diawi()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
private_lane :config_xcodegen_alpha do
|
||||||
|
target_file_path = "../ElementX/SupportingFiles/target.yml"
|
||||||
|
data = YAML.load_file target_file_path
|
||||||
|
data["targets"]["ElementX"]["settings"]["base"]["PRODUCT_NAME"] = "ElementX PR"
|
||||||
|
data["targets"]["ElementX"]["settings"]["base"]["PRODUCT_BUNDLE_IDENTIFIER"] = "io.element.elementx.pr"
|
||||||
|
File.open(target_file_path, 'w') { |f| YAML.dump(data, f) }
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
lane :build_and_publish_on_github do
|
lane :build_and_publish_on_github do
|
||||||
ios_adhoc()
|
ios_adhoc()
|
||||||
|
|
||||||
@ -44,7 +97,7 @@ end
|
|||||||
|
|
||||||
desc "Upload IPA to Diawi"
|
desc "Upload IPA to Diawi"
|
||||||
private_lane :upload_to_diawi do
|
private_lane :upload_to_diawi do
|
||||||
api_token = "" #ENV["DIAWI_API_TOKEN"]
|
api_token = ENV["DIAWI_API_TOKEN"]
|
||||||
UI.user_error!("Invalid Diawi API token.") unless !api_token.to_s.empty?
|
UI.user_error!("Invalid Diawi API token.") unless !api_token.to_s.empty?
|
||||||
|
|
||||||
# Upload to Diawi
|
# Upload to Diawi
|
||||||
@ -57,6 +110,14 @@ private_lane :upload_to_diawi do
|
|||||||
# Get the Diawi link from Diawi action shared value
|
# Get the Diawi link from Diawi action shared value
|
||||||
diawi_link = lane_context[SharedValues::UPLOADED_FILE_LINK_TO_DIAWI]
|
diawi_link = lane_context[SharedValues::UPLOADED_FILE_LINK_TO_DIAWI]
|
||||||
UI.command_output("Diawi link: " + diawi_link.to_s)
|
UI.command_output("Diawi link: " + diawi_link.to_s)
|
||||||
|
|
||||||
|
# Generate the Diawi QR code file link
|
||||||
|
diawi_app_id = URI(diawi_link).path.split('/').last
|
||||||
|
diawi_qr_code_link = "https://www.diawi.com/qrcode/link/#{diawi_app_id}"
|
||||||
|
|
||||||
|
# Set "DIAWI_FILE_LINK" to GitHub environment variables for Github actions
|
||||||
|
sh("echo DIAWI_FILE_LINK=#{diawi_link} >> $GITHUB_ENV")
|
||||||
|
sh("echo DIAWI_QR_CODE_LINK=#{diawi_qr_code_link} >> $GITHUB_ENV")
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Create GitHub Release"
|
desc "Create GitHub Release"
|
||||||
@ -84,3 +145,22 @@ private_lane :release_to_github do
|
|||||||
upload_assets: ["build/ElementX.app.zip"]
|
upload_assets: ["build/ElementX.app.zip"]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private_lane :update_app_icon do
|
||||||
|
pr_number = ENV["GITHUB_PR_NUMBER"]
|
||||||
|
UI.user_error!("Invalid GitHub PR number.") unless !pr_number.to_s.empty?
|
||||||
|
caption_text="PR ##{pr_number}"
|
||||||
|
|
||||||
|
Dir.glob("../ElementX/Resources/Assets.xcassets/AppIcon.appiconset/**/*.png") do |file_name|
|
||||||
|
# Change the icons color
|
||||||
|
sh("convert '#{file_name}' -modulate 100,100,200 '#{file_name}'")
|
||||||
|
|
||||||
|
caption_width = sh("identify -format %w '#{file_name}'")
|
||||||
|
caption_height = file_name.end_with?("@2x.png") ? 60 : 30
|
||||||
|
if caption_width.to_i > caption_height*2 then
|
||||||
|
|
||||||
|
# Add a label on top
|
||||||
|
sh("convert -background '#0008' -fill white -gravity center -size '#{caption_width}'x'#{caption_height}' caption:'#{caption_text}' '#{file_name}' +swap -gravity south -composite '#{file_name}'")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@ -3,3 +3,4 @@
|
|||||||
# Ensure this file is checked in to source control!
|
# Ensure this file is checked in to source control!
|
||||||
|
|
||||||
gem 'fastlane-plugin-diawi'
|
gem 'fastlane-plugin-diawi'
|
||||||
|
gem 'fastlane-plugin-xcodegen'
|
||||||
|
@ -13,6 +13,14 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do
|
|||||||
|
|
||||||
# Available Actions
|
# Available Actions
|
||||||
|
|
||||||
|
### alpha
|
||||||
|
|
||||||
|
```sh
|
||||||
|
[bundle exec] fastlane alpha
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### build_and_publish_on_github
|
### build_and_publish_on_github
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
Loading…
x
Reference in New Issue
Block a user