add travis script to retrive deploy message (for push to build repo)

This commit is contained in:
Maximilian Keßler 2021-10-22 19:56:44 +02:00
parent 022bb0f9ff
commit 47cb82c8cb
3 changed files with 19 additions and 2 deletions

View file

@ -1,5 +1,11 @@
import os
from PyTeX.build.git_hook import get_latest_commit
def get_latest_commit(repo):
if repo.head.is_detached:
return repo.head.commit
else:
return repo.head.ref.commit
def get_deploy_message(repo):

View file

@ -0,0 +1,7 @@
from deploy.deploy_message import get_deploy_message
import git
if __name__ == "__main__":
repo = git.Repo(search_parent_directories=True)
msg = get_deploy_message(repo)
print(msg)

View file

@ -1,6 +1,9 @@
# ! /bin/sh
TRAVIS_BRANCH=algebraic-geometry
TRAVIS_BUILD_DIR=/home/maximilian/LatexPackages
cd ${TRAVIS_BUILD_DIR}
rm -rf LatexPackagesBuild
git clone https://github.com/kesslermaximilian/LatexPackagesBuild.git LatexPackagesBuild
@ -10,10 +13,11 @@ REMOTE_BRANCH=$(git branch -a | sed -n '/remotes\/origin\/.*-build/p' | sed 's/r
echo ${REMOTE_BRANCH}
if [ "$REMOTE_BRANCH" = "" ];then
echo "This is the first build on this branch, creating new branch in build repository to push to"
git checkout --orphan ${TRAVIS_BRANCH}-build
ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' | xargs -r git rm --cached
ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' | xargs -r rm -rf
else
echo "found"
echo "Checking out remote branch from last build"
git checkout -b ${REMOTE_BRANCH}-build origin/${REMOTE_BRANCH}-build
fi