Skip to content
Snippets Groups Projects
Commit 97229abe authored by Nico's avatar Nico
Browse files

add script for experimental autoupdate

parent ed441967
No related branches found
No related tags found
No related merge requests found
......@@ -18,4 +18,6 @@ build:
- cat gitlab-known-hosts >> ~/.ssh/known_hosts
script:
- ./update-gluon.sh
- rm -rf gluon
- ./update-gluon-experimental.sh
cache: {}
#!/bin/bash
set -x
set -eu
set -o pipefail
gluon_fork_git_url="ssh://git@gitlab.freifunk-stuttgart.de:22220/firmware/gluon.git"
gluon_upstream_git_url="https://github.com/freifunk-gluon/gluon.git"
site_git_url="ssh://git@gitlab.freifunk-stuttgart.de:22220/firmware/site-ffs.git"
git clone "$gluon_fork_git_url" gluon
cd gluon
git remote add upstream "$gluon_upstream_git_url"
git checkout experimental
# search in the fork for the newest tag of our fork with custom patches
fork_tag=$(git tag | grep -E '^experimental-[0-9]{4}-[0-9]{2}-[0-9]{2}$' | sort | tail -n1)
echo Fork is at "$fork_tag"
# check that we have a base tag
base_tag="$fork_tag-base"
if ! git rev-parse "$base_tag"; then
echo Base tag "$base_tag" does not exist
exit 1
fi
echo Base is at "$base_tag"
git fetch upstream master
rebase_output=$(git rebase "$base_tag" --onto FETCH_HEAD)
if [ "$rebase_output" = "Current branch experimental is up to date." ]; then
echo No changes in branch. not doing anything.
exit 0
fi
fork_commit=$(git rev-parse --verify "$fork_tag")
current_commit=$(git rev-parse --verify HEAD)
# we didn't change anything - no new upstream release, no need to do anything
if [ "$current_commit" = "$fork_commit" ]; then
echo fork commit "$upstream_commit" matches current commit - not doing anything
exit 0
fi
new_tag_name="experimental-$(date +%Y-%m-%d)"
new_base_tag_name="$new_tag_name-base"
git tag -a "$new_tag_name" -m "Release $new_tag_name"
git tag -a "$new_base_tag_name" -m "Release $new_base_tag_name" FETCH_HEAD
git push origin "$new_tag_name"
git push origin "$new_base_tag_name"
git push --force-with-lease origin
cd ..
git clone --recurse "$site_git_url"
cd site-ffs
git checkout experimental
git submodule sync
git submodule update
git -C gluon fetch
git -C gluon checkout "$new_tag_name"
git add gluon
git commit -m "automatic update to gluon $new_tag_name"
git push
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment