Skip to content

Commit

Permalink
Add automatic timestamp to deploy-helper script
Browse files Browse the repository at this point in the history
  • Loading branch information
jppellet committed Apr 18, 2024
1 parent 0ee07b2 commit 62931a7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
15 changes: 13 additions & 2 deletions deployment/deploy-helper
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ commit-save() {

# Assuming everything has been pulled, find last commit on dev branch now
GIT_PAGER=cat last_dev_commit=$(git log dev -1 --pretty="format:%h %ci %an %s")
echo "The last commit on dev branch will be saved as this one:"
echo "This commit from dev will be referenced for '${type}':"
echo " $last_dev_commit"
# ask to confirm waiting for newline
read -p "Do you want to save this commit to the control file? (y/n) " -r
Expand All @@ -93,7 +93,7 @@ commit-save() {
completed "Saved to file $target_file"

git add "$target_file"
echo 'git commit -m "New ${type} reference commit"'
echo "Please run: git commit -m \"New ${type} reference commit\""
}


Expand Down Expand Up @@ -128,9 +128,20 @@ deploy() {
part="$1"
subdomain="$2"

readable_date=$(date )

rm -rf "${root_dir}/build"
run "Clean build for '$part'" sphinx-build src/$part build -E

# replace {{timestamp}} in main file
main_file="${root_dir}/build/index.html"
timestamp="<div style=\"margin-top: 3em; font-size: 80%; opacity: 75%;\">Version: $(date +"%Y-%m-%d %H:%M:%S") (commit $(git rev-parse --short HEAD))</div>"
sed "s|{{timestamp}}|${timestamp}|" < "$main_file" > "$main_file.new"
rm "$main_file"
mv "$main_file.new" "$main_file"

cd "${root_dir}" && run "Generating PDFs" make modulo.pdf

server="31826.ftp.infomaniak.com"
run "Copying" rsync -avz --progress --delete "${root_dir}/build/" "${SSH_USER}@${server}:sites/${subdomain}/"
run "Settings" rsync -avz --progress "${helper_dir}/additionalfiles/${part}/" "${SSH_USER}@${server}:sites/${subdomain}/"
Expand Down
3 changes: 2 additions & 1 deletion src/appr/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Informatique au gymnase : apprendre

Bienvenue dans le cours d'informatique au gymnase.
Ce cours a été conçu pour vous accompagner dans votre découverte de l'informatique. Il est
découpé en **huit thématiques** réparties sur deux années.
découpé en **huit thématiques** réparties sur deux années. Il est aussi disponible en version `pdf <pdf/modulo.pdf>`_.

.. toctree::
:name: Première année
Expand Down Expand Up @@ -78,3 +78,4 @@ Deuxième année
: ce chapitre vous fait découvrir comment fonctionne Internet. Il est aussi disponible en version `pdf <media/resx.pdf>`_


{{timestamp}}
1 change: 1 addition & 0 deletions src/ens/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ La plateforme est améliorée grâce à vos retours, n’hésitez pas à nous le
readme/extensions


{{timestamp}}

0 comments on commit 62931a7

Please sign in to comment.