sh Travis CI:检查标签,生成发行说明,签署二进制文件并上传到Tryouts以进行发布分发

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Travis CI:检查标签,生成发行说明,签署二进制文件并上传到Tryouts以进行发布分发相关的知识,希望对你有一定的参考价值。

#!/bin/sh
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
  echo "This is a pull request. No deployment will be done."
  exit 0
fi
if [[ "$TRAVIS_BRANCH" != "master" ]]; then
  echo "Testing on a branch other than master. No deployment will be done."
  exit 0
fi

CURRENT_TAG=`git describe --exact-match --abbrev=0 --tags`

if [[ $CURRENT_TAG == "" ]]; then
  echo "No tags found, no need for a release."
  exit 0
fi

echo "***************************"
echo "*    Generating Notes     *"
echo "***************************"

PREVIOUS_TAG=`git describe HEAD^1 --abbrev=0 --tags`
GIT_HISTORY=`git log --no-merges --format="- %s" $PREVIOUS_TAG..HEAD`

if [[ $PREVIOUS_TAG == "" ]]; then
  GIT_HISTORY=`git log --no-merges --format="- %s"`
fi

echo "Current Tag: $CURRENT_TAG"
echo "Previous Tag: $PREVIOUS_TAG"
echo "Release Notes:

$GIT_HISTORY"

# Thanks @djacobs https://gist.github.com/djacobs/2411095
# Thanks @johanneswuerbach https://gist.github.com/johanneswuerbach/5559514

PROVISIONING_PROFILE="$HOME/Library/MobileDevice/Provisioning Profiles/$PROFILE_NAME.mobileprovision"
OUTPUTDIR="$PWD/build/Release-iphoneos"

echo "***************************"
echo "*        Signing          *"
echo "***************************"
xcrun -log -sdk iphoneos PackageApplication "$OUTPUTDIR/$APP_NAME.app" -o "$OUTPUTDIR/$APP_NAME.ipa" -sign "$DEVELOPER_NAME" -embed "$PROVISIONING_PROFILE"

zip -r -9 "$OUTPUTDIR/$APP_NAME.app.dSYM.zip" "$OUTPUTDIR/$APP_NAME.app.dSYM"

RELEASE_DATE=`date '+%Y-%m-%d %H:%M:%S'`
RELEASE_NOTES="Build: $CURRENT_TAG
Uploaded: $RELEASE_DATE

$GIT_HISTORY"


if [ ! -z "$TRYOUTS_APP_ID" ] && [ ! -z "$TRYOUTS_APP_TOKEN" ]; then
  echo ""
  echo "************************"
  echo "* Uploading to Tryouts *"
  echo "************************"
  curl https://tryouts.io/applications/$TRYOUTS_APP_ID/upload/ \
    -F status="2" \
    -F notify="0" \
    -F notes="$RELEASE_NOTES" \
    -F build="@$OUTPUTDIR/$APP_NAME.ipa" \
    -H "Authorization: $TRYOUTS_APP_TOKEN"
fi

以上是关于sh Travis CI:检查标签,生成发行说明,签署二进制文件并上传到Tryouts以进行发布分发的主要内容,如果未能解决你的问题,请参考以下文章

sh travis-ci或任何其他ci的自动语义版本控制

sh 将分支自动合并为travis-ci或任何其他ci的master

Travis CI自动部署Hexo博客

sh https://swiftenv.fuller.li/en/latest/integrations/travis-ci.html

sh Gradle / Bash - 将所有env变量复制到app / gradle.properties(用于从travis或circle CI复制秘密env变量以构建android proj

sh Gradle / Bash - 将所有env变量复制到app / gradle.properties(用于从travis或circle CI复制秘密env变量以构建android proj