代码拉取完成,页面将自动刷新
#!/bin/bash
set -ev
getVersion() {
./gradlew properties -q | grep "version:" | grep -v "kotlin_version:" | awk '{print $2}' | tr -d '[:space:]'
}
removeSnapshots() {
sed -i 's/-SNAPSHOT//' gradle.properties
}
commitRelease() {
local APP_VERSION=$(getVersion)
git commit -a -m "Update version for release"
git tag -a "v${APP_VERSION}" -m "Tag release version"
}
bumpVersion() {
echo "Bump version number"
local APP_VERSION=$(getVersion | xargs)
local SEMANTIC_REGEX='^([0-9]+)\.([0-9]+)(\.([0-9]+))?$'
if [[ ${APP_VERSION} =~ ${SEMANTIC_REGEX} ]]; then
if [[ ${BASH_REMATCH[4]} ]]; then
nextVersion=$((BASH_REMATCH[4] + 1))
nextVersion="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${nextVersion}-SNAPSHOT"
else
nextVersion=$((BASH_REMATCH[2] + 1))
nextVersion="${BASH_REMATCH[1]}.${nextVersion}-SNAPSHOT"
fi
echo "Next version: ${nextVersion}"
sed -i -E "s/^version(\s)?=.*/version=${nextVersion}/" gradle.properties
else
echo "No semantic version and therefore cannot publish to maven repository: '${APP_VERSION}'"
fi
}
commitNextVersion() {
git commit -a -m "Update version for release"
}
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
echo "Deploying release to Maven Central"
removeSnapshots
./gradlew clean build publishToSonatype closeAndReleaseSonatypeStagingRepository
commitRelease
bumpVersion
commitNextVersion
git push --follow-tags
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。