check sync with remote on versioned build

This commit is contained in:
Jakob 2022-11-22 11:06:27 +01:00
parent 635d49b75b
commit 4e0f7c965d

View File

@ -1,4 +1,4 @@
.PHONY: install_docker main.pdf clean redo test_git test_version versioned check-common-typos
.PHONY: install_docker main clean redo test_git test_version versioned latexdiff check-common-typos
DOCKER_VERSION=latest
@ -7,9 +7,12 @@ LATEXMK=$(DOCKER) latexmk
XETEX=$(DOCKER) xetex
LATEXDIFFVC=$(DOCKER) latexdiff-vc
# keep as first command to build stuff
main.pdf: main.tex main.bib
$(LATEXMK) -pdfxe main.tex # use xelatex to build pdf
# keep as first command to build by default
main: main.tex main.bib
$(LATEXMK) -pdf -sy main.tex # use xelatex to build pdf
main-xe: main.tex main.bib
$(LATEXMK) -pdfxe main.tex
install_docker:
docker pull texlive/texlive:$(DOCKER_VERSION)
@ -17,16 +20,13 @@ install_docker:
clean:
$(LATEXMK) -c
x=`biber --cache` && if [ -d "$x" ]; then $(RM) $x; fi
#$(RM) *.out *.aux *.log *.bbl *.blg *~ *.toc *.idx *.eps dummy *.fls *.fdb_latexmk *.bcf *.run.xml *.xdv
#$(RM) $(patsubst %.tex, %.ps, $(wildcard *.tex))
#$(RM) $(patsubst %.tex, %.dvi, $(wildcard *.tex))
#$(RM) $(patsubst %.tex, %.pdf, $(wildcard *.tex))
redo: clean main.pdf
test_git:
if [ -z "$$(git status --untracked-files=no --porcelain)" ]; then exit 0; else echo -e "\nERROR: working directory not clean. commit changes before running versioned build"; exit 1; fi
# TODO check if we are also synced to at least one remote
if [ -z "$$(git status --untracked-files=no --porcelain)" ]; then exit 0; else echo -e "\nERROR: working directory not clean. commit changes before running versioned build."; exit 1; fi
git remote update
if [ -z "$$(git status -uno | grep -q 'Your branch is up to date')" ]; then exit 0; else echo -e "\nERROR: not synced to remote. push changes before running a versioned build."; exit 1; fi
test_version:
rm -f .version_local