2

我是iOS開發人員和 我一直在玩Gitlab,最近試圖找出比redmine + jenkins + HockeyApp更好/更方便。 Gitlab似乎相當酷,除了我無法弄清楚如何將我的臨時iOS構建上傳到HockeyApp(或TestFlight)。它甚至有可能嗎?Gitlab持續交付選項

謝謝

回答

0

我結束了以下配置:

添加deploy.sh文件:

#!/bin/bash 
echo "deploy to hockeyapp" 

HOCKEYAPP_APP_NAME="MyApp.iOS.ipa" 
HOCKEYAPP_TOKEN="MyTOKEN" 
HOCKEYAPP_ID="MYAPPID" 

function buildNotes { 

    # We need an initial bullet point for our list of commit logs 
    echo -n "* " 
    # Get the latest app uploads 
    curl -H "X-HockeyAppToken: $HOCKEYAPP_TOKEN" \ 
    "https://rink.hockeyapp.net/api/2/apps/$HOCKEYAPP_ID/app_versions?page=1" | \ 
    # Put every property on a separate line 
    sed 's/,/\n/g' | \ 
    # Remove all the quotation marks 
    sed 's/"//g' | \ 
    # Look at only the notes properties 
    grep notes | \ 
    # Look at the first one, i.e. the latest app upload 
    head -n 1 | \ 
    # Find the commit information at the bottom of the notes 
    sed -n 's/.*(commit:\([^)]*\)).*/\1/p' | \ 
    # Let's find all the logs since that commit 
    xargs -I '{}' git log {}..HEAD --pretty=format:'%h %s' --no-merges | \ 
    # Add a star to each newline to make the list 
    sed ':a;N;$!ba;s/\n/\n* /g' 
    # The end of the revision log must have the latest commit 
    # This is so later we can do the above again 
    echo 
    echo -n "* (commit:" 
    git rev-parse HEAD | xargs echo -n 
    echo -n ')' 
} 

function deployAppFlavor() { 
    echo "executeCurlCommand" 
    curl -F "status=2" \ 
    -F "notify=1" \ 
    -F "notes=<release_notes" \ 
    -F "notes_type=0" \ 
    -F "[email protected]/build/MyApp.iOS.ipa/$1" \ 
    -H "X-HockeyAppToken: $2"\ 
    "https://rink.hockeyapp.net/api/2/apps/$3/app_versions/upload" 
} 

function deployApp { 
    buildNotes > release_notes 
    deployAppFlavor $HOCKEYAPP_APP_NAME $HOCKEYAPP_TOKEN $HOCKEYAPP_ID 
} 

deployApp 

,然後更新YML文件:

build_project: 
    stage: build 

    script: 
    - xcodebuild clean -workspace MyApp.iOS.xcworkspace -scheme MyApp.iOS -quiet 
    - xcodebuild build -workspace MyApp.iOS.xcworkspace -scheme MyApp.iOS -destination 'platform=iOS Simulator,name=iPhone 6s' | xcpretty -s > -quiet 

archive_project: 
    stage: archive 
    script: 
    - xcodebuild clean archive -archivePath "build/MyApp.iOS.xcarchive" -workspace "MyApp.iOS.xcworkspace" -scheme MyApp.iOS -quiet 
    - xcodebuild -exportArchive -archivePath "build/MyApp.IOS.xcarchive" -exportPath "build/MyApp.iOS.ipa" -exportOptionsPlist "export.plist" -quiet 
    artifacts: 
    paths: 
     - src/build/MyApp.iOS.ipa 

deploy: 
    before_script: 
    - chmod +x ./scripts/deploy.sh 
    stage: deploy 
    script: 
    - ./scripts/deploy.sh