Created
June 4, 2019 10:52
-
-
Save sergebat/546459a59a23b2010f2e7c1626c7dd6b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo off | |
rem *** Configuration *** | |
set PUTTY_SESSION="mbp.local" | |
set [email protected] | |
set ALTOOL_USER_PASSWORD=aaaa-bbbb-cccc-dddd | |
set ALTOOL_PATH_OSX='/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Versions/A/Support/altool' | |
IF "%~1"=="" goto noparams | |
where pscp > nul | |
if ERRORLEVEL 1 goto pscp_missing | |
where plink > nul | |
if ERRORLEVEL 1 goto plink_missing | |
IF "%~1"=="--test" goto testconnection | |
echo Uploading %1 to mac (%PUTTY_SESSION%) | |
pscp -load %PUTTY_SESSION% %1 %PUTTY_SESSION%:latest.ipa | |
echo Uploading %1 to App Store with Application Loader | |
plink %PUTTY_SESSION% %ALTOOL_PATH_OSX% -u %ALTOOL_USER_NAME% -p %ALTOOL_USER_PASSWORD% -f latest.ipa --upload-app | |
if ERRORLEVEL 127 goto altool_missing | |
if ERRORLEVEL 1 goto altool_error | |
exit 0 | |
rem Usage and error messages | |
:noparams | |
echo upload-to-appstore: CMD script to upload IPA to the App Store. | |
echo *** Requires Mac accessible via SSH *** | |
echo. | |
echo Usage: upload-to-appstore file.ipa | |
echo. | |
echo file.ipa iOS App Archive, make sure it is signed with distribution provisioning profile | |
echo. | |
echo Before you start using it: | |
echo - Install https://www.putty.org/ | |
echo - Configure, save and test Putty SSH session to access your Mac https://tartarus.org/~simon/putty-snapshots/htmldoc/Chapter4.html#config-session | |
echo - Configure putty session name, app store user name and onetime application password in the *** Configuration *** section of this script | |
echo - Make sure Application Loader is setup and works fine on your Mac https://developer.apple.com/support/app-store-connect/ | |
echo. | |
exit 0 | |
:plink_missing | |
echo Error: Cannot find plink.exe. | |
echo. | |
echo What is plink? | |
echo plink is a Windows command-line connection tool similar to UNIX ssh | |
echo This script uses plink to invoke Application Loader remotely on Mac | |
echo. | |
echo How to fix this issue? | |
echo plink comes with Putty SSH Windows client https://www.putty.org/ | |
echo After installing Putty, you need to add its command line tools to your PATH | |
echo Plink docs: https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter7.html#plink-starting | |
exit 1 | |
:pscp_missing | |
echo Error: Cannot find pscp.exe. | |
echo. | |
echo What is pscp? | |
echo pscp, the PuTTY Secure Copy client on Windows, is a tool for transferring files using an SSH connection. | |
echo This script uses pscp to copy your IPA to Mac | |
echo. | |
echo How to fix this issue? | |
echo pscp comes with Putty SSH Windows client https://www.putty.org/ | |
echo After installing Putty, you need to add its command line tools to your PATH | |
echo pscp docs: https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter5.html#pscp | |
exit 1 | |
:altool_missing | |
echo Error: Application Loader command line tool (altool) not found on Mac | |
echo Bash returned error code: %ERRORLEVEL% | |
echo Current path: %ALTOOL_PATH_OSX% | |
echo. | |
echo What is altool? | |
echo Application Loader is a utility that comes with XCode and is used to upload IPA to App Store. | |
echo altool is a command line interface for Application Loader. | |
echo. | |
echo How to fix this issue? | |
echo Login to your Mac and make sure you can manually upload IPA with Application Loader. | |
echo Make sure the path to this utility is specified correctly. It may be different in different | |
echo xcode versions. Find altool and specify correct path in ALTOOL_PATH_OSX variable in this config. | |
exit 1 | |
:altool_error | |
echo Error: altool reported an error code %ERRORLEVEL% | |
exit 1 | |
:testconnection | |
echo Connecting to mac via %PUTTY_SESSION% with plink... | |
echo If you see altool help below, this script is configured correctly! | |
echo. | |
plink %PUTTY_SESSION% %ALTOOL_PATH_OSX% | |
if ERRORLEVEL 127 goto altool_missing | |
if ERRORLEVEL 1 goto :t | |
echo. | |
echo. Success! | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment