如何管理所有代码实例中的应用版本?



我在monorepo中有一个项目。它包含一大堆提到应用程序版本的文件:

./app/app.json <- expo.io
./app/package.json
./api/package.json
./cloud-functions/<15 cloud functions here>/package.json
etc...

我有各种部署脚本,每个脚本都需要版本号。严格来说,我必须在每次合并到git中的主dev分支时更新版本。

是否有一种常见的做法或其他东西在一个地方管理版本代码?

现在,我使用它,也许有人会改进它?

#!/bin/bash
OLD_VERSION=`cat scripts/current-version-code`
echo $NEW_VERSION
if [ -z "$1" ]; then
read -p "Current version is $NEW_VERSION. What is new version? " NEW_VERSION
else
NEW_VERSION=$1
fi
if [ -z "$NEW_VERSION" ]
then
echo "No version specified"
exit 1
fi
sed -e "/"version":.*$/{s//"version": "$NEW_VERSION",/;:a" -e '$!N;$!ba' -e "}" -i '' 'api-server/package.json'
sed -e "/"version":.*$/{s//"version": "$NEW_VERSION",/;:a" -e '$!N;$!ba' -e "}" -i '' 'cloud-functions/deleteTransactions/package.json'
sed -e "/"version":.*$/{s//"version": "$NEW_VERSION",/;:a" -e '$!N;$!ba' -e "}" -i '' 'cloud-functions/emailSend/package.json'
sed -e "/"version":.*$/{s//"version": "$NEW_VERSION",/;:a" -e '$!N;$!ba' -e "}" -i '' 'cloud-functions/exportUsersBq/package.json'
sed -e "/"version":.*$/{s//"version": "$NEW_VERSION",/;:a" -e '$!N;$!ba' -e "}" -i '' 'cloud-functions/getWholesalers/package.json'
sed -e "/"version":.*$/{s//"version": "$NEW_VERSION",/;:a" -e '$!N;$!ba' -e "}" -i '' 'cloud-functions/mongoUpdateByWholesaler/package.json'
sed -e "/"version":.*$/{s//"version": "$NEW_VERSION",/;:a" -e '$!N;$!ba' -e "}" -i '' 'admin/package.json'
sed -e "/"version":.*$/{s//"version": "$NEW_VERSION",/;:a" -e '$!N;$!ba' -e "}" -i '' 'expo-app/package.json'
sed -i ''  "s|$OLD_VERSION|$NEW_VERSION|g" 'expo-app/app.json'
sed -i ''  "s|$OLD_VERSION|$NEW_VERSION|g" 'scripts/current-version-code'

相关内容

  • 没有找到相关文章

最新更新