Update update-submodules.yml

This commit is contained in:
Magne Sjaastad
2024-08-13 15:32:19 +02:00
committed by GitHub
parent 123baa5d4e
commit 0ee28b73dd

View File

@@ -26,27 +26,38 @@ jobs:
- name: Update submodules to latest release
run: |
cd ThirdParty
submodules=("fast_float" "qtadvanceddocking" "regression-analysis" "roff-cpp" "spdlog" "tomlplusplus" )
submodules=("fast_float" "spdlog" "tomlplusplus" )
for submodule in "${submodules[@]}"; do
BRANCH_NAME=ci-update-$submodule
if git show-ref --verify --quiet refs/heads/$BRANCH_NAME; then
if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then
echo "Branch $BRANCH_NAME exists."
git checkout $BRANCH_NAME
git checkout -b "$BRANCH_NAME" "origin/$BRANCH_NAME"
else
echo "Branch $BRANCH_NAME does not exist. Creating branch."
git checkout -b $BRANCH_NAME
git checkout -b "$BRANCH_NAME"
fi
cd $submodule
git fetch --tags
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $latest_tag
cd ..
git add $submodule
git commit -m "Update $submodule to $latest_tag" || echo "No changes to commit"
git push origin $BRANCH_NAME
git checkout dev
if [ -n "$latest_tag" ]; then
git checkout $latest_tag
else
echo "Empty tag detected in $submodule. Nothing to do."
fi
cd ..
if git diff --quiet; then
echo "No changes detected in $submodule"
else
git add $submodule
git commit -m "Update $submodule to $latest_tag" || echo "No changes to commit"
git push origin "$BRANCH_NAME"
fi
git checkout dev
git reset --hard origin/dev --recurse-submodule
done
env:
@@ -54,7 +65,7 @@ jobs:
- name: Create Pull Requests for each submodule
run: |
submodules=("fast_float" "qtadvanceddocking" "regression-analysis" "roff-cpp" "spdlog" "tomlplusplus" )
submodules=("fast_float" "spdlog" "tomlplusplus" )
for submodule in "${submodules[@]}"; do
gh pr create --title "Update $submodule to latest release" --body "This PR updates the $submodule submodule to its latest release." --head ci-update-$submodule --base dev
done