Skip to content

Commit

Permalink
PIA-000: Add workflow to archive a development build
Browse files Browse the repository at this point in the history
  • Loading branch information
kp-laura-sempere committed Dec 22, 2023
1 parent 4618b55 commit 058545a
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 1 deletion.
56 changes: 56 additions & 0 deletions .github/workflows/development_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: development_build
on:
push:
branches:
- master

workflow_dispatch:
concurrency:
group: "${{ github.ref }}"
cancel-in-progress: true
jobs:
build:
runs-on: macos-13
env:
CERTIFICATE_PASSWORD: ${{ secrets.DEVELOPER_CERTIFICATE_PASSWORD }}
KEYCHAIN_NAME: ${{ secrets.KEYCHAIN_NAME }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}

steps:
- name: Setup Git credentials
run: |
git config --global url."https://${{ secrets.ORG_GITHUB_USERNAME }}:${{ secrets.ORG_GITHUB_TOKEN }}@github.com/".insteadOf "[email protected]:"
- uses: actions/checkout@v3

- name: Select XCode version
run: sudo xcode-select -s /Applications/Xcode_14.3.1.app

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.2

- name: Install Fastlane
run: gem install fastlane

- name: Decode Developer Certificates
run: echo "${{ secrets.DEVELOPER_IOS_CERTIFICATE }}" | base64 --decode > ./fastlane/Certificate.p12

- name: Set up development certificates and profiles
run: bundle exec fastlane get_development_profiles > /dev/null 2>&1

- name: Create artifacts dir
run: mkdir artifacts

- name: Archive development build
run: bundle exec fastlane development_build

- name: Upload development ipa file
uses: actions/upload-artifact@v4
with:
path: artifacts/

45 changes: 44 additions & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,53 @@ platform :ios do
end

desc "This line is for settin up the certificates and provisioning profiles"
lane :get_profiles do
lane :get_profiles do |options|
api_key = app_store_connect_api_key(
key_id: key_id,
issuer_id: issuer_id,
key_content: key_content
)

certificates
development_profiles = options[:development] || false

get_provisioning_profile(
development: development_profiles,
api_key: api_key,
app_identifier: "com.privateinternetaccess.ios.PIA-VPN"
)

get_provisioning_profile(
development: development_profiles,
api_key: api_key,
app_identifier: "com.privateinternetaccess.ios.PIA-VPN.Tunnel"
)

get_provisioning_profile(
development: development_profiles,
api_key: api_key,
app_identifier: "com.privateinternetaccess.ios.PIA-VPN.WG-Tunnel"
)

get_provisioning_profile(
development: development_profiles,
api_key: api_key,
app_identifier: "com.privateinternetaccess.ios.PIA-VPN.PIAWidget"
)

get_provisioning_profile(
development: development_profiles,
api_key: api_key,
app_identifier: "com.privateinternetaccess.ios.PIA-VPN.AdBlocker"
)

end

desc "This line is for setting up the certificates and provisioning profiles for development builds"
lane :get_development_profiles do
get_profiles(development: true)
end

desc "This line is for creating testflight build"
lane :testflight_build do
api_key = app_store_connect_api_key(
Expand Down Expand Up @@ -93,6 +104,38 @@ platform :ios do
import_certificates
end

desc "This line is for creating a developer build"
lane :development_build do

current_branch = git_branch()
commit_hash = last_git_commit()
short_hash = commit_hash[:abbreviated_commit_hash]
archive_path = "PIA_VPN_iOS.#{current_branch}_#{short_hash}"
archive_zip_name = "#{archive_path}.zip"

build_app(scheme: "PIA VPN",
export_method: "development",
clean: true,
configuration: "Debug",
build_path: "build/#{archive_path}",
output_name: "#{archive_path}.ipa",
export_options: {
provisioningProfiles: {
"com.privateinternetaccess.ios.PIA-VPN" => "match Development com.privateinternetaccess.ios.PIA-VPN",
"com.privateinternetaccess.ios.PIA-VPN.Tunnel" => "match Development com.privateinternetaccess.ios.PIA-VPN.Tunnel",
"com.privateinternetaccess.ios.PIA-VPN.WG-Tunnel" => "match Development com.privateinternetaccess.ios.PIA-VPN.WG-Tunnel",
"com.privateinternetaccess.ios.PIA-VPN.PIAWidget" => "match Development com.privateinternetaccess.ios.PIA-VPN.PIAWidget",
"com.privateinternetaccess.ios.PIA-VPN.AdBlocker" => "match Development com.privateinternetaccess.ios.PIA-VPN.AdBlocker"
}
}
)

zip(output_path: archive_zip_name, path: "#{archive_path}.ipa")
sh "mv ../#{archive_zip_name} ../artifacts/#{archive_zip_name}"

end


desc "Increase build number for TestFlight"
private_lane :increment_build_number_testflight do
build_number = latest_testflight_build_number(
Expand Down

0 comments on commit 058545a

Please sign in to comment.