Skip to content

πŸš€ TestAPP laurentcabondm started a new patch release in stable channel #51

πŸš€ TestAPP laurentcabondm started a new patch release in stable channel

πŸš€ TestAPP laurentcabondm started a new patch release in stable channel #51

name: Release new Sample App version
run-name: πŸš€ TestAPP ${{ github.actor }} started a new ${{inputs.version_bump_Type}} release in ${{inputs.channel_type}} channel
on:
workflow_dispatch:
inputs:
channel_type:
description: 'Choose Release channel'
required: true
default: 'stable'
type: choice
options:
- stable
- beta
- alpha
version_bump_Type:
description: 'Type of Version Number Bump'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
jobs:
Release-new-sample-app-version:
runs-on: macos-13
if: always() && !cancelled() && !contains(needs.*.result, 'failure')
steps:
- name: Setup Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Checkout main repo
uses: actions/checkout@v3
with:
path: main
token: ${{ secrets.GIT_TOKEN}}
- name: Setup ENV VARS
run: |
echo "CI_MAIN_REPO_PATH=$GITHUB_WORKSPACE/main" >> $GITHUB_ENV
- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.SAMPLE_APP_ENTERPRISE_CERT }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
PROD_BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.PROD_BUILD_PROVISION_PROFILE_BASE64 }}
ALPHA_BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.ALPHA_BUILD_PROVISION_PROFILE_BASE64 }}
BETA_BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BETA_BUILD_PROVISION_PROFILE_BASE64 }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
PROD_PP_PATH=$RUNNER_TEMP/Dailymotion_Sample_InHouse.mobileprovision
BETA_PATH=$RUNNER_TEMP/Dailymotion_Sample_InHouse_Beta.mobileprovision
ALPHA_PATH=$RUNNER_TEMP/Dailymotion_Sample_InHouse_Alpha.mobileprovision
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$PROD_BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PROD_PP_PATH
echo -n "$BETA_BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $BETA_PATH
echo -n "$ALPHA_BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $ALPHA_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PROD_PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
cp $BETA_PATH ~/Library/MobileDevice/Provisioning\ Profiles
cp $ALPHA_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Set up ruby env
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.3
bundler-cache: true
- name: Config environment
run: |
chmod +x ./main/ci_scripts/config_env.sh
./main/ci_scripts/config_env.sh
shell: bash
- name: Sample App Release
env:
APP_CENTER_SECRET_ALPHA: ${{ secrets.APP_CENTER_SECRET_ALPHA }}
APP_CENTER_SECRET_BETA: ${{ secrets.APP_CENTER_SECRET_BETA }}
APP_CENTER_SECRET_PROD: ${{ secrets.APP_CENTER_SECRET_PROD }}
run: |
cd $(echo "${CI_MAIN_REPO_PATH}")
env="alpha"
target="Alpha"
apiToken=""
case ${{inputs.channel_type}} in
stable)
env="prod" ; target="Prod"
apiToken=$APP_CENTER_SECRET_PROD
;;
beta)
env="beta" ; target="Beta"
apiToken=$APP_CENTER_SECRET_BETA
;;
alpha)
env="alpha" ; target="Alpha"
apiToken=$APP_CENTER_SECRET_ALPHA
;;
*)
echo -n "Unknown release channel_type" ; exit 1
;;
esac
echo "ENV $env, Target $target"
echo "ApiToken chars: ${#apiToken}"
appDelegatePath=${CI_MAIN_REPO_PATH}/DailymotionPlayerSample/AppDelegate.swift
infoPlistPath=${CI_MAIN_REPO_PATH}/DailymotionPlayerSample/Info.plist
sed -i '' -e "s/<<AppCenterSecret>>/${apiToken}/g" $appDelegatePath
echo "AppDelegate at path ${appDelegatePath} secret replaced"
sed -i '' -e "s/AppCenterSecretPLIST/appcenter-${apiToken}/g" $infoPlistPath
echo "Info.plist at path ${infoPlistPath} secret replaced"
echo "Start build"
bundle exec fastlane ios SAMPLE_APP_CREATE_RELEASE api_token:$apiToken target:$target bump_type:${{ inputs.version_bump_Type }} --env $env --verbose
echo "Build Finished"
echo "Removing secrets"
sed -i '' -e "s/${apiToken}/<<AppCenterSecret>>/g" $appDelegatePath
echo "AppDelegate secret replaced"
sed -i '' -e "s/appcenter-${apiToken}/AppCenterSecretPLIST/g" $infoPlistPath
echo "Info.plist secret replaced"
echo "Start Tag the version"
bundle exec fastlane ios TEST_APP_GIT_TAG target:$target --verbose
shell: bash