Skip to content

Commit f78d41f

Browse files
committed
Add Git Commands to justfile
Handles: - old local branches - creation of chore branches for each or individual versions
1 parent 8981d00 commit f78d41f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

justfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,34 @@ build-assets-all-local: build-versions-all
173173
just build-assets-local-for ${version}
174174
done
175175

176+
# Remove old branches that had been merged to main
177+
[group('git')]
178+
git-clean:
179+
git branch --merged | grep -Ev "(^\*|^\+|master|main|dev)" | xargs --no-run-if-empty git branch -d
180+
181+
# Create Chore branch for specific Kubernetes Version
182+
[group('git')]
183+
git-chore-branch VERSION:
184+
#!/usr/bin/env bash
185+
currentBranch=$(git branch --show-current)
186+
git switch -c chore/update-{{replace(VERSION, "-", ".") }}
187+
cp -r providers/openstack/out/{{replace(VERSION, ".", "-") }}/* providers/openstack/scs/
188+
git add providers/openstack/scs/
189+
git commit -s -S -m "chore(versions): Update Release for {{replace(VERSION, "-", ".") }}"
190+
#git push
191+
git switch ${currentBranch}
192+
193+
# Create chore branches for all available out versions
194+
[group('git')]
195+
git-chore-branches-all:
196+
#!/usr/bin/env bash
197+
if ! [[ -e providers/openstack/out ]]; then
198+
echo "Error: out directory does not exists."
199+
else
200+
pushd providers/openstack/out
201+
versions=$(echo *)
202+
popd
203+
for version in ${versions[@]}; do
204+
just git-chore-branch $version
205+
done
206+
fi

0 commit comments

Comments
 (0)