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

Use match to get code signing certificates #201

Open
wants to merge 58 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
a5cf87b
Use match to get code signing certificates
magkue Oct 29, 2024
999aaba
Merge branch 'develop' into ci/fastlane-using-match
anian03 Oct 31, 2024
f7a17cf
Add build workflow
anian03 Oct 31, 2024
8333723
try bundle exec instead of fastlane
anian03 Oct 31, 2024
8ed2eee
Add bundle update
anian03 Oct 31, 2024
0148d24
Try bundle update --bundler
anian03 Oct 31, 2024
33e586b
try installing bundler version
anian03 Oct 31, 2024
49759ee
Revert to bundle update and fastlane build
anian03 Oct 31, 2024
ac87b18
Update build workflow, add release workflow, update git fullname in f…
magkue Nov 4, 2024
fbd2bda
Get ruby version in workflow
magkue Nov 4, 2024
0844c49
Setup ruby in workflow
magkue Nov 4, 2024
fee6f5a
Use locally installed ruby
magkue Nov 4, 2024
a5287be
Check ruby version
magkue Nov 4, 2024
70fbbb2
Add relevant params to PATH
magkue Nov 4, 2024
ade7b63
Use $GITHUB_PATH
magkue Nov 4, 2024
9309712
Remove ruby setup
magkue Nov 4, 2024
2ac8d4d
Run in custom shell
magkue Nov 4, 2024
ca23dc1
Add {0} to default shell
magkue Nov 4, 2024
e3411c8
Print out path
magkue Nov 4, 2024
d2a152e
Update build-and-test-ios-app.yml
magkue Nov 4, 2024
e4fab1c
rbenv
magkue Nov 4, 2024
a4204d7
Revert changes
magkue Nov 4, 2024
fa90ec7
Revert changes
magkue Nov 4, 2024
f944020
Display path
magkue Nov 4, 2024
c759fdd
Set shell
magkue Nov 4, 2024
a447aa1
Update build-and-test-ios-app.yml
magkue Nov 4, 2024
bcb1e0a
Manually add to path
magkue Nov 4, 2024
0fd7e92
Update build-and-test-ios-app.yml
magkue Nov 4, 2024
525c15b
Add creation of temp keychain
magkue Nov 12, 2024
0d2b480
Use temp keychain in match
magkue Nov 12, 2024
42bada1
Set keychain to not being default
magkue Nov 12, 2024
c522248
Remove duplicated sign method
magkue Nov 12, 2024
af2c237
Disable automatic signing
magkue Nov 12, 2024
4f75d01
Add app identifier
magkue Nov 12, 2024
c088245
Update fastfile
magkue Nov 12, 2024
a86e89d
Update fastfile
magkue Nov 12, 2024
10ad1fb
use new default keychain
magkue Nov 19, 2024
4aa8237
Merge branch 'ci/fastlane-using-match' of github.com:ls1intum/artemis…
magkue Nov 19, 2024
afd2667
use new default keychain
magkue Nov 19, 2024
47dfc3f
remove optional parameter signing key
magkue Nov 19, 2024
c0b95bb
Change code signing identity to Apple Distribution
magkue Nov 19, 2024
83c4f27
Try adding development team
anian03 Nov 20, 2024
82d25a2
Add debug info to workflow
anian03 Nov 22, 2024
4f71482
Update build-and-test-ios-app.yml
anian03 Nov 22, 2024
7c2ff3e
Update Fastfile
anian03 Nov 22, 2024
afd89b8
Update Fastfile
anian03 Nov 22, 2024
7fc9081
Update build-and-test-ios-app.yml
anian03 Nov 22, 2024
b96f9fe
Update build-and-test-ios-app.yml
anian03 Nov 22, 2024
4ede2e4
Update build-and-test-ios-app.yml
anian03 Nov 22, 2024
f025150
Update build-and-test-ios-app.yml
anian03 Nov 22, 2024
e280c4b
Update build-and-test-ios-app.yml
anian03 Nov 22, 2024
3eccf23
Add team_id to fast file
anian03 Nov 22, 2024
38f458e
Add app identifier to match action
anian03 Nov 28, 2024
6c8abc8
Use ios keychain as default
anian03 Nov 28, 2024
58905c0
add keychain to search list
anian03 Nov 28, 2024
c9ad49c
try setting default keychain
anian03 Nov 28, 2024
de21a8b
Set keychain path
anian03 Nov 28, 2024
9e3b2c6
try search list replace
anian03 Nov 28, 2024
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
41 changes: 41 additions & 0 deletions .github/workflows/build-and-test-ios-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: build-and-test-ios-app

on:
push:
branches-ignore:
- main
- develop
workflow_call:
workflow_dispatch:

jobs:
build:
permissions:
contents: read
runs-on: [self-hosted, macOS]
steps:
- uses: actions/checkout@v2

- name: Set Path
run: |
echo "/opt/homebrew/bin:/Users/github-runner/.rbenv/shims:$PATH" >> $GITHUB_PATH

- name: Update Bundler
run: bundle update

- name: Check static code quality of iOS App
run: bundle exec fastlane swift_lint

# - name: Run Unit and UI Tests
# run: bundle exec fastlane test

- name: Build iOS App
run: bundle exec fastlane build
env:
BUILD_NUMBER: ${{ github.run_number }}
IOS_MATCH_GITLAB_AUTH: ${{ secrets.IOS_MATCH_GITLAB_AUTH }}
IOS_KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }}
IOS_APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.IOS_APP_STORE_CONNECT_API_KEY_KEY_ID }}
IOS_APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.IOS_APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
IOS_APP_STORE_CONNECT_API_KEY_PASSWORD: ${{ secrets.IOS_APP_STORE_CONNECT_API_KEY_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.IOS_MATCH_PASSWORD }}
26 changes: 26 additions & 0 deletions .github/workflows/release-ios-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: release-ios-app

on:
push:
branches:
- develop
workflow_dispatch:

jobs:
build:
permissions:
contents: read
uses: ./.github/workflows/build-and-test-ios-app.yml

release:
needs: build
runs-on: [self-hosted, macOS]
steps:
- uses: actions/checkout@v2

- name: Upload iOS App to TestFlight
run: bundle exec fastlane upload_to_testflight
env:
IOS_APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.IOS_APP_STORE_CONNECT_API_KEY_KEY_ID }}
IOS_APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.IOS_APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
IOS_APP_STORE_CONNECT_API_KEY_PASSWORD: ${{ secrets.IOS_APP_STORE_CONNECT_API_KEY_PASSWORD }}
100 changes: 36 additions & 64 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
# https://docs.fastlane.tools/plugins/available-plugins
#

# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
update_fastlane

default_platform(:ios)

Expand Down Expand Up @@ -48,83 +47,59 @@ platform :ios do

desc "[CI] Default build configuration"
lane :build do
app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
team_id = CredentialsManager::AppfileConfig.try_fetch_value(:team_id)

##########################################
# Environment Setup
##########################################

# Unlock the keychain
unlock_keychain(
path: ENV['bamboo_KeyChain'],
password: ENV['bamboo_KeyChainPassword'],
)

xcode_select "/Applications/Xcode.app"

# If the build number was specified by the CI environment,
# use it to specify the build number for this build
if ENV["bamboo_buildNumber"]
increment_build_number(
build_number: ENV["bamboo_buildNumber"]
)
end

info_plist_path = "Artemis/Supporting/Info.plist"

set_info_plist_value(
path: info_plist_path,
key: "ITSAppUsesNonExemptEncryption",
value: "NO"
key: "CFBundleVersion",
value: ENV['BUILD_NUMBER']
)

##########################################
# Certificates
##########################################

# Download certificates
# from the apple developer portal
get_certificates(
api_key: api_key,
keychain_path: ENV['bamboo_KeyChain'],
keychain_password: ENV['bamboo_KeyChainPassword']
unlock_keychain(
path: "~/Library/Keychains/ios-db",
password: ENV['IOS_KEYCHAIN_PASSWORD'],
add_to_search_list: :replace
# set_default: true
)

##########################################
# Provisioning Profile
# Configure Code Signing via Match
##########################################

# Download the latest provisioning profile
# from the apple developer portal
get_provisioning_profile(
api_key: api_key,
force: true
match(
type: "appstore",
team_id: team_id,
app_identifier: app_identifier,
api_key: api_key,
git_full_name: "Artemis IOS",
git_branch: "main", # branch to store and get certificates from
clone_branch_directly: true, # optional
git_user_email: "[email protected]",
git_url: "https://gitlab.lrz.de/ase/ipraktikum/match-code-signing",
readonly: false,
keychain_name: "ios",
keychain_password: ENV['IOS_KEYCHAIN_PASSWORD'],
git_basic_authorization: ENV['IOS_MATCH_GITLAB_AUTH'], # Base-64 encoded, format gitlab_auth_token_name:gitlab_auth_token
verbose: true # optional but very helpful
)

##########################################
# Project Setup
# Build
##########################################

# Update AppID for publishing
update_app_identifier(
plist_path: info_plist_path
)

# Update Xcode Project to use maunual code signing
profile_mapping = Actions.lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING]
update_code_signing_settings(
use_automatic_signing: false,
code_sign_identity: "iPhone Distribution",
profile_uuid: lane_context[SharedValues::SIGH_UUID],
profile_name: lane_context[SharedValues::SIGH_NAME]
)

# Define correct Provisioning Profile in Xcode Project
update_project_provisioning(
build_configuration: "Release"
profile_name: profile_mapping[app_identifier]
)

##########################################
# Code sign and Build
##########################################

# Build the app
build_ios_app(
clean: true, # Do a clean build each time
Expand All @@ -134,17 +109,14 @@ platform :ios do
cloned_source_packages_path: ".SwiftPackages", # Custom path for cloning source packages to
derived_data_path: ".DerivedData", # Custom derived data path
output_directory: "./build", # Directory where the output artifacts are generated
scheme: "Artemis", # We want to build the "HallOfFame" scheme
codesigning_identity: "Apple Distribution: Technische Universitaet Muenchen (Edu) (T7PP2KY2B6)",
scheme: "Artemis",
xcargs: "-skipMacroValidation -skipPackagePluginValidation"
)
end

desc "[CI] Upload a previous build app to TestFlight"
lane :release do
# Support for older fastlane environments
# ENV["SPACESHIP_CONNECT_API_IN_HOUSE"] = "true"

xcode_select "/Applications/Xcode.app"

upload_to_testflight(
ipa: "#{Dir.pwd}/../build/App.ipa",
Expand All @@ -159,9 +131,9 @@ platform :ios do
lane :api_key do
app_store_connect_api_key(
duration: 300, # This Token is valid for 300s
key_id: ENV["bamboo_ASE_APP_STORE_CONNECT_API_KEY_KEY_ID"],
issuer_id: ENV["bamboo_ASE_APP_STORE_CONNECT_API_KEY_ISSUER_ID"],
key_content: ENV["bamboo_ASE_APP_STORE_CONNECT_API_KEY_PASSWORD"],
key_id: ENV["IOS_APP_STORE_CONNECT_API_KEY_KEY_ID"],
issuer_id: ENV["IOS_APP_STORE_CONNECT_API_KEY_ISSUER_ID"],
key_content: ENV["IOS_APP_STORE_CONNECT_API_KEY_PASSWORD"],
is_key_content_base64: true
)
end
Expand Down
Loading