Update release tool with new merge strategy

* Fast-forward `latest` tag to merged tag
* Don't merge into TARGET_BRANCH
* Fix missing argon2 in snapcraft.yml
This commit is contained in:
Jonathan White 2022-03-20 22:12:29 -04:00
parent 9e21df2515
commit 1e73d549ed
6 changed files with 24 additions and 52 deletions

View File

@ -91,10 +91,11 @@ Please join an existing language team or request a new one if there is none.
The Branch Strategy is based on [git-flow-lite](http://nvie.com/posts/a-successful-git-branching-model/).
* **master** points to the latest public release
* **develop** points to the development of the next release, contains tested and reviewed code
* **feature/**[name] points to a branch with a new feature, one which is candidate for merge into develop (subject to rebase)
* **hotfix/**[name] points to a branch with a fix for a particular issue ID
* **fix/**[name] points to a branch with a fix for a particular issue ID
Note: The **latest** tag is used to point to the most recent stable release.
### Git commit messages

4
.github/pull.yml vendored
View File

@ -3,10 +3,6 @@
# pull from: https://github.com/keepassxreboot/keepassxc
version: "1"
rules:
- base: master
upstream: keepassxreboot:master
mergeMethod: hardreset
- base: develop
upstream: keepassxreboot:develop
mergeMethod: rebase

View File

@ -1,6 +1,6 @@
# Changelog
## Release 2.7.0 (2022-02-26)
## 2.7.0 (2022-03-20)
### Major Additions
- Implement KDBX 4.1 [#7114]

View File

@ -39,7 +39,6 @@ GPG_KEY="CFB4C2166397D0D2"
GPG_GIT_KEY=""
OUTPUT_DIR="release"
SOURCE_BRANCH=""
TARGET_BRANCH="master"
TAG_NAME=""
DOCKER_IMAGE=""
DOCKER_CONTAINER_NAME="keepassxc-build-container"
@ -98,7 +97,6 @@ Options:
leave empty to let Git choose your default key
(default: '${GPG_GIT_KEY}')
-r, --release-branch Source release branch to merge from (default: 'release/VERSION')
--target-branch Target branch to merge to (default: '${TARGET_BRANCH}')
-t, --tag-name Override release tag name (defaults to version number)
-h, --help Show this help
EOF
@ -279,7 +277,7 @@ checkGitRepository() {
}
checkReleaseDoesNotExist() {
if ! git tag | grep -q "^$TAG_NAME$"; then
if [ $(git tag -l $TAG_NAME) ]; then
exitError "Release '$RELEASE_NAME' (tag: '$TAG_NAME') already exists!"
fi
}
@ -296,12 +294,6 @@ checkSourceBranchExists() {
fi
}
checkTargetBranchExists() {
if ! git rev-parse "$TARGET_BRANCH" > /dev/null 2>&1; then
exitError "Target branch '$TARGET_BRANCH' does not exist!"
fi
}
checkVersionInCMake() {
local app_name_upper="$(echo "$APP_NAME" | tr '[:lower:]' '[:upper:]')"
local major_num="$(echo ${RELEASE_NAME} | cut -f1 -d.)"
@ -326,7 +318,7 @@ checkChangeLog() {
exitError "No CHANGELOG file found!"
fi
if ! grep -qzo "## ${RELEASE_NAME} \([0-9]{4}-[0-9]{2}-[0-9]{2}\)\n" CHANGELOG.md; then
if ! grep -qEzo "## ${RELEASE_NAME} \([0-9]{4}-[0-9]{2}-[0-9]{2}\)" CHANGELOG.md; then
exitError "'CHANGELOG.md' has not been updated to the '${RELEASE_NAME}' release!"
fi
}
@ -341,17 +333,6 @@ checkAppStreamInfo() {
fi
}
checkSnapcraft() {
if [ ! -f snap/snapcraft.yaml ]; then
echo "Could not find snap/snapcraft.yaml!"
return
fi
if ! $GREP -qPzo "KEEPASSXC_BUILD_TYPE=Release" snap/snapcraft.yaml; then
exitError "'snapcraft.yaml' is not set for a release build!"
fi
}
checkTransifexCommandExists() {
if ! cmdExists tx; then
exitError "Transifex tool 'tx' not installed! Please install it using 'pip install transifex-client'."
@ -403,7 +384,6 @@ performChecks() {
checkReleaseDoesNotExist
checkWorkingTreeClean
checkSourceBranchExists
checkTargetBranchExists
logInfo "Checking out '${SOURCE_BRANCH}'..."
git checkout "$SOURCE_BRANCH" > /dev/null 2>&1
@ -413,7 +393,6 @@ performChecks() {
checkVersionInCMake
checkChangeLog
checkAppStreamInfo
checkSnapcraft
logInfo "\e[1m\e[32mAll checks passed!\e[0m"
}
@ -499,10 +478,6 @@ merge() {
SOURCE_BRANCH="$2"
shift ;;
--target-branch)
TARGET_BRANCH="$2"
shift ;;
-t|--tag-name)
TAG_NAME="$2"
shift ;;
@ -540,17 +515,14 @@ merge() {
fi
fi
CHANGELOG=$(grep -Ezo "## ${RELEASE_NAME} \([0-9]{4}-[0-9]{2}-[0-9]{2}\)\n\n(.|\n)+?\n\n## " CHANGELOG.md \
local flags="-Pzo"
if [ -n "$OS_MACOS" ]; then
flags="-Ezo"
fi
CHANGELOG=$(grep ${flags} "## ${RELEASE_NAME} \([0-9]{4}-[0-9]{2}-[0-9]{2}\)\n\n(.|\n)+?\n\n## " CHANGELOG.md \
| tail -n+3 | sed '$d' | sed 's/^### //')
COMMIT_MSG="Release ${RELEASE_NAME}"
logInfo "Checking out target branch '${TARGET_BRANCH}'..."
git checkout "$TARGET_BRANCH" > /dev/null 2>&1
logInfo "Merging '${SOURCE_BRANCH}' into '${TARGET_BRANCH}'..."
git merge "$SOURCE_BRANCH" --no-ff -m "$COMMIT_MSG" -m "${CHANGELOG}" "$SOURCE_BRANCH" -S"$GPG_GIT_KEY"
logInfo "Creating tag '${TAG_NAME}'..."
if [ -z "$GPG_GIT_KEY" ]; then
git tag -a "$TAG_NAME" -m "$COMMIT_MSG" -m "${CHANGELOG}" -s
@ -558,6 +530,13 @@ merge() {
git tag -a "$TAG_NAME" -m "$COMMIT_MSG" -m "${CHANGELOG}" -s -u "$GPG_GIT_KEY"
fi
logInfo "Fast-Forward latest tag..."
if [ -z "$GPG_GIT_KEY" ]; then
git tag -sf -a "latest" -m "Latest stable release"
else
git tag -sf -u "$GPG_GIT_KEY" -a "latest" -m "Latest stable release"
fi
cleanup
logInfo "All done!"

View File

@ -83,8 +83,6 @@ param(
[string] $Tag,
[Parameter(ParameterSetName = "merge")]
[string] $SourceBranch,
[Parameter(ParameterSetName = "merge")]
[string] $TargetBranch = "master",
[Parameter(ParameterSetName = "build")]
[string] $VSToolChain,
[Parameter(ParameterSetName = "merge")]
@ -279,8 +277,8 @@ if ($Merge) {
$SourceBranch = & git branch --show-current
}
if ($SourceBranch -notmatch "^release/.*|develop$") {
throw "Must be on develop or a release/* branch to continue merging."
if ($SourceBranch -notmatch "^release/.*$") {
throw "Must be on a release/* branch to continue."
}
# Update translation files
@ -314,15 +312,12 @@ if ($Merge) {
}
}
Write-Host "Checking out target branch '$TargetBranch'..."
Invoke-Cmd "git" "checkout `"$TargetBranch`"" -quiet
Write-Host "Merging '$SourceBranch' into '$TargetBranch'..."
Invoke-Cmd "git" "merge `"$SourceBranch`" --no-ff -m `"Release $Version`" -m `"$Changelog`" `"$SourceBranch`" -S" -quiet
Write-Host "Creating tag for '$Version'..."
Invoke-Cmd "git" "tag -a `"$Version`" -m `"Release $Version`" -m `"$Changelog`" -s" -quiet
Write-Host "Moving latest tag..."
Invoke-Cmd "git" "tag -f -a `"latest`" -m `"Latest stable release`" -s" -quiet
Write-Host "All done!"
Write-Host "Please merge the release branch back into the develop branch now and then push your changes."
Write-Host "Don't forget to also push the tags using 'git push --tags'."

View File

@ -42,6 +42,7 @@ parts:
build-packages:
- g++
- libbotan-2-dev
- libargon2-dev
- zlib1g-dev
- libqrencode-dev
- libusb-1.0-0-dev