mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Update update-submodules.yml
This commit is contained in:
33
.github/workflows/update-submodules.yml
vendored
33
.github/workflows/update-submodules.yml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user