/ push
push
1 #!/usr/bin/env bash 2 3 # https://github.com/cirosantilli/china-dictatorship#mirrors 4 5 set -eux 6 7 echo $# 8 if [ $# -gt 0 ]; then 9 dry_run=true 10 else 11 dry_run=false 12 fi 13 make 14 make multipage 15 if ! $dry_run; then 16 git push --follow-tags 17 git push -f git@github.com:cirosantilli/china-dictatorship-2.git & 18 git push -f git@gitlab.com:cirosantilli/china-dictatorship.git & 19 git push -f git@github.com:mRFWq7LwNPZjaVv5v6eo/cihna-dictattorshrip-8 & 20 git push -f git@gitlab.binets.fr:ciro.duran-santilli/china-dictatorship.git & 21 wait 22 fi 23 24 out_dir=out 25 out_multipage_dir="${out_dir}/multipage" 26 27 function multipage-fixup() ( 28 # Ain't nobody got time for Ruby coding!!! 29 # https://github.com/owenh000/asciidoctor-multipage/issues/20 30 # https://github.com/owenh000/asciidoctor-multipage/issues/21 31 # https://github.com/owenh000/asciidoctor-multipage/issues/22 32 find "$1" -name '*.html' ! -name 'index.html' | xargs perl -lapi -e ' 33 s/<h[2-6] id="/<h2 id="/g; 34 s/href="README.html"/href="index-split"/g; 35 s/(href="(?![^"]+:\/\/)[^"]+).html(#[^"]*)?"/\1\2"/g; 36 ' 37 # Not possible, it is identical to other lists actually... 38 # s/(<div class="paragraph nav-footer">)/<h2>Table of contents<\/h2>\1/g; 39 ) 40 41 # GitHub pages. 42 # One time initial setup. 43 # git checkout --orphan gh-pages 44 # and copy over https://github.com/cirosantilli/jekyll-min 45 gh_pages_dir="${out_dir}/gh-pages" 46 if [ ! -d "$gh_pages_dir" ]; then 47 mkdir -p "$gh_pages_dir" 48 git clone --branch gh-pages --depth 1 "$(git remote get-url origin)" "$gh_pages_dir" 49 fi 50 cp README.html "${gh_pages_dir}/index.html" 51 cp "${out_multipage_dir}/"* "$gh_pages_dir" 52 mv "${gh_pages_dir}/README.html" "${gh_pages_dir}/index-split.html" 53 multipage-fixup "$gh_pages_dir" 54 if ! $dry_run; then 55 git -C "$gh_pages_dir" add . 56 if git -C "$gh_pages_dir" commit -m "$(git log -1 --format="%H")"; then 57 git -C "$gh_pages_dir" push -f 58 fi 59 fi 60 61 # GitLab pages 62 gl_pages_dir="${out_dir}/gl-pages" 63 gl_pages_public_dir="${gl_pages_dir}/public" 64 if [ ! -d "$gl_pages_dir" ]; then 65 mkdir -p "${out_dir}" 66 git clone --branch gl-pages --depth 1 git@gitlab.com:cirosantilli/china-dictatorship.git "$gl_pages_dir" 67 fi 68 make MEDIA=https://gitlab.com/cirosantilli/china-dictatorship-media/-/raw/master OUT="${gl_pages_public_dir}/index.html" 69 cp .gitlab-ci.yml "${gl_pages_dir}" 70 cp "${out_multipage_dir}/"* "$gl_pages_public_dir" 71 mv "${gl_pages_public_dir}/README.html" "${gl_pages_public_dir}/index-split.html" 72 multipage-fixup "$gl_pages_public_dir" 73 if ! $dry_run; then 74 git -C "$gl_pages_dir" add . 75 if git -C "$gl_pages_dir" commit -m "$(git log -1 --format="%H")"; then 76 git -C "$gl_pages_dir" push -f 77 fi 78 fi