发布脚本

2022/4/8 23:25:50

本文主要是介绍发布脚本,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

#!/bin/bash
prefix=""
if `git status | grep "master" &>/dev/null`; then
      prefix="prod-pj"
elif `git status | grep "preview" &>/dev/null`; then
    prefix="preview-pj"
elif `git status | grep "staging" &>/dev/null`; then
    prefix="staging-pj"
else
   echo "must checkout branch release or test or staging"
   exit
fi
function build_tag_push() {
    git push
    git pull --tags
    local new_tag=$(echo ${prefix}-$(date +'%Y%m%d')-$(git tag -l "${prefix}-$(date +'%Y%m%d')-*" | wc -l | xargs printf '%02d'))
    echo ${new_tag}
    git tag -a ${new_tag} -m 'create new tag'
    git push origin ${new_tag}
}

 



这篇关于发布脚本的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程