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