icinga-php-thirdparty/bin/make-snapshot.sh
Johannes Meyer a3a9a0f9a8 bin/make-snapshot: Auto resolve composer.lock conflicts
dependabot seems to use an older composer version, causing
conflicts with the property `plugin-api-version`. Anyway,
the merge leading to the conflict is only done to make
a tag reachable. So the composer.lock of the main branch
is always the right choice.
2025-07-09 10:45:14 +02:00

29 lines
825 B
Bash
Executable File

#!/bin/bash
set -xe
BRANCH="$1"
if [ -z $BRANCH ]; then
echo "USAGE: $0 <branch>"
echo " e.g.: $0 snapshot/nightly"
exit 1
fi
LATEST_TAG=$(git for-each-ref refs/tags --sort=-taggerdate --format='%(refname)' --count=1 | awk -F/ '{print $3}')
NEXT_VERSION=$(echo "${LATEST_TAG:1}" | awk -F. -v OFS=. '{$3=0}; {++$2}; {print}')
if [[ -n $(git branch | grep $BRANCH) ]]; then
git branch -D $BRANCH
fi
git checkout -b $BRANCH
git mv composer.lock composer.lock.bak
git commit -am "Backup composer.lock"
git merge --no-ff -m "Merge latest tag, package pipelines require it" $LATEST_TAG || git checkout --ours composer.lock.bak && git add composer.lock.bak && git commit --no-edit
git mv -f composer.lock.bak composer.lock
git commit -am "Restore composer.lock"
bin/make-release.sh "$NEXT_VERSION-dev" --no-checkout