Skip to content

Merge pull request #195 from V1taS/feature/Sosin_Vitalii/change-lib-v5 #151

Merge pull request #195 from V1taS/feature/Sosin_Vitalii/change-lib-v5

Merge pull request #195 from V1taS/feature/Sosin_Vitalii/change-lib-v5 #151

name: Upload to App Store Connect
on:
push:
branches:
- master
jobs:
upload_to_app_store_connect:
runs-on: macos-latest
if: "!contains(github.event.head_commit.message, 'Update versions')"
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.x
- name: Set up Python dependencies
run: |
python -m pip install --upgrade pip
pip install python-telegram-bot
- name: Import certificate and provisioning profiles
env:
IOS_CERTIFICATE: ${{ secrets.IOS_CERTIFICATE }}
IOS_PROVISIONING_PROFILE: ${{ secrets.IOS_PROVISIONING_PROFILE }}
RANDOM_YES_NO_WIDGET_PROFILE: ${{ secrets.RANDOM_YES_NO_WIDGET_PROFILE }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
echo "$IOS_CERTIFICATE" | base64 --decode > /tmp/Certificate.p12
echo "$IOS_PROVISIONING_PROFILE" | base64 --decode > /tmp/Profile.mobileprovision
echo "$RANDOM_YES_NO_WIDGET_PROFILE" | base64 --decode > /tmp/RandomYesNoWidgetProfile.mobileprovision
security create-keychain -p "$KEYCHAIN_PASSWORD" ~/Library/Keychains/build.keychain
security default-keychain -s ~/Library/Keychains/build.keychain
security unlock-keychain -p "$KEYCHAIN_PASSWORD" ~/Library/Keychains/build.keychain
security set-keychain-settings -lut 3600 ~/Library/Keychains/build.keychain
security import /tmp/Certificate.p12 -k ~/Library/Keychains/build.keychain -P "" -T /usr/bin/codesign -A
security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PASSWORD" ~/Library/Keychains/build.keychain
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp /tmp/Profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
cp /tmp/RandomYesNoWidgetProfile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
PROVISIONING_PROFILE_UUID=$(grep -a -A 1 "UUID" /tmp/Profile.mobileprovision | tail -1 | awk -F '<string>' '{print $2}' | awk -F '</string>' '{print $1}')
RANDOM_YES_NO_WIDGET_PROFILE_UUID=$(grep -a -A 1 "UUID" /tmp/RandomYesNoWidgetProfile.mobileprovision | tail -1 | awk -F '<string>' '{print $2}' | awk -F '</string>' '{print $1}')
echo "PROVISIONING_PROFILE_UUID=$PROVISIONING_PROFILE_UUID" >> $GITHUB_ENV
echo "RANDOM_YES_NO_WIDGET_PROFILE_UUID=$RANDOM_YES_NO_WIDGET_PROFILE_UUID" >> $GITHUB_ENV
- name: Set up Tuist
run: |
curl -Ls https://install.tuist.io | bash
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Set up fastlane
run: |
gem install bundler
bundle install --jobs 4 --retry 3
- name: Tuist fetch
run: |
tuist fetch
- name: Download App versions from SosinVitalii.com server
run: |
curl --ssl-reqd --insecure --user ${{ secrets.FTP_USERNAME }}:${{ secrets.FTP_PASSWORD }} -O "ftp://${{ secrets.FTP_SERVER }}/versions.json"
- name: Increase App version and build number
run: |
python Scripts/update_version_and_build_number.py
- name: Update marketing and current project version in Project
run: |
python Scripts/update_appearance_versions.py
- name: Upload App versions to SosinVitalii.com server
run: |
curl --ssl-reqd --insecure --user ${{ secrets.FTP_USERNAME }}:${{ secrets.FTP_PASSWORD }} -T "./versions.json" "ftp://${{ secrets.FTP_SERVER }}/versions.json"
- name: Tuist generate
run: |
tuist generate
- name: Build and archive the app
run: |
bundle exec fastlane build
env:
APP_IDENTIFIER: ${{ secrets.APP_IDENTIFIER }}
PROVISIONING_PROFILE_UUID: ${{ env.PROVISIONING_PROFILE_UUID }}
SIGNING_CERTIFICATE: ${{ secrets.SIGNING_CERTIFICATE }}
- name: Upload App build artifact
uses: actions/upload-artifact@v3
with:
name: Random
path: "Random.ipa"
- name: Upload dSYM build artifact
uses: actions/upload-artifact@v3
with:
name: Random.app.dSYM
path: "Random.app.dSYM.zip"
- name: Upload to App Store Connect
run: |
bundle exec fastlane upload_app_to_app_store
env:
APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}
APP_IDENTIFIER: ${{ secrets.APP_IDENTIFIER }}
PROVISIONING_PROFILE_UUID: ${{ env.PROVISIONING_PROFILE_UUID }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }}
APP_STORE_CONNECT_TEAM_NAME: ${{ secrets.APP_STORE_CONNECT_TEAM_NAME }}
ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
ITC_TEAM_NAME: ${{ secrets.ITC_TEAM_NAME }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
- name: Clean up App Store Connect API key
run: |
rm -f /tmp/AuthKey.p8
- name: Get MARKETING_VERSION and CURRENT_PROJECT_VERSION
run: |
echo "MARKETING_VERSION=$(jq -r '.marketing_version' versions.json)" >> $GITHUB_ENV
echo "CURRENT_PROJECT_VERSION=$(jq -r '.current_project_version' versions.json)" >> $GITHUB_ENV
- name: Create and push Release git tag
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions Bot"
git checkout ${GITHUB_HEAD_REF}
git tag "${{ env.MARKETING_VERSION }}"
git push --tags
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
- name: Send Telegram notification "New Release"
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
run: |
python Scripts/send_telegram.py "😍 Release iOS ${{ env.MARKETING_VERSION }} 😍
Автор: ${{ github.actor }}
Сборка №: ${{ env.MARKETING_VERSION }}/${{ env.CURRENT_PROJECT_VERSION }}
Для тестирования релизных сборок отправьте свой Apple ID ([email protected]) пользователю @V1taS
"