LoginSignup
1
0

More than 5 years have passed since last update.

Azure Pipelines から Android アプリを DeployGate に配信するスクリプト Ver.2

Posted at

Android/iOSアプリを Azure Pipelines から DeployGate に配信する - Qiita の続き。スクリプトを汎用化した。

Pipelines のタスクに Bash を追加して、こんな感じで設定。

image.png

Script の内容

↓をコピペで。

TOKEN="$deploygate_token"
DEPLOYGATE_USER="$deploygate_user"
APK_DIR="$deploygate_apk_dir"
APK_FILTER="$deploygate_apk_filter"
MESSAGE="$deploygate_message"

echo "DEPLOYGATE_USER=$DEPLOYGATE_USER"
echo "APK_DIR=$APK_DIR"
echo "APK_FILTER=$APK_FILTER"
echo "MESSAGE=$MESSAGE"

FILES=$(find $APK_DIR -name $APK_FILTER -type f)
for f in ${FILES[@]}
do
    echo "APK_PATH=$f"

    curl \
      -F "token=$TOKEN" \
      -F "file=@$f" \
      -F "message=$MESSAGE" \
"https://deploygate.com/api/users/${DEPLOYGATE_USER}/apps"
    break
done

Environment Variables

  • deploygate_token - DeployGate の APIキー
  • deploygate_user - DeployGate の ユーザーID
  • deploygate_apk_dir - DeployGate に配信する APK が出力されたディレクトリ。普通は $(build.binariesdirectory)/$(BuildConfiguration)
  • deploygate_apk_filter - deploygate_apk_dir の中から APK を見つけるためのフィルタ。なので *.apk でいいはず。
  • deploygate_message − DeployGate の配信バージョンにつけるコメント。By Azure Pipelines $(Build.BuildId) - $(Build.SourceVersionMessage) としておくと、良い感じに Azure Pipelines のビルド番号と最終コミットメッセージが伝搬される。

次の Ver.3 は iOS との共通化を図る予定。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0