#!/usr/bin/env bash
# fail if any commands fails
set -e
# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully
set -o pipefail
# debug log
set -x
# write your script here
tag="$BITRISE_GIT_TAG"
app_version="0.0.0"
build_number="1"
if [ ! -z "$tag" ] ; then
echo $tag
pattern='[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'
if [[ $tag =~ $pattern ]]; then
app_version=${BASH_REMATCH[0]}
else echo 'App Version not found';
fi
build_number=${tag##*-}
envman add --key app_build_number --value "$build_number"
envman add --key app_version --value "$app_version"
fi
1条答案
按热度按时间7xzttuei1#
我最终处理这个问题的方法是用下面的代码添加一个自定义脚本步骤。它看起来有点黑客,但一直工作可靠。
字符串