Browse Source

try split page publish

pull/396/merge
Ciro Santilli 10 months ago
parent
commit
10005e286d
  1. 3
      Gemfile
  2. 9
      Gemfile.lock
  3. 29
      Makefile
  4. 12
      push

3
Gemfile

@ -1,5 +1,6 @@
source 'https://rubygems.org'
gem 'asciidoctor', '2.0.10'
gem 'asciidoctor', '2.0.11'
gem 'asciidoctor-multipage', '0.0.12 '
gem 'concurrent-ruby', '1.1.7'
gem 'tilt', '2.0.10'

9
Gemfile.lock

@ -1,7 +1,9 @@
GEM
remote: https://rubygems.org/
specs:
asciidoctor (2.0.10)
asciidoctor (2.0.11)
asciidoctor-multipage (0.0.12)
asciidoctor (>= 2.0.11, < 2.1)
concurrent-ruby (1.1.7)
tilt (2.0.10)
@ -9,9 +11,10 @@ PLATFORMS
ruby
DEPENDENCIES
asciidoctor (= 2.0.10)
asciidoctor (= 2.0.11)
asciidoctor-multipage (= 0.0.12)
concurrent-ruby (= 1.1.7)
tilt (= 2.0.10)
BUNDLED WITH
2.0.2
2.2.5

29
Makefile

@ -1,6 +1,15 @@
.PHONY: clean
.PHONY: clean multipage
IN = README.adoc
OPTS = \
--failure-level info \
--template-dir template_dir \
--trace \
-v
OUT = README.html
OUT_DIR = out
OUT_MULTIPAGE_DIR = $(OUT_DIR)/multipage
OUT_MULTIPAGE = $(OUT_MULTIPAGE_DIR)/README.html
HEAD = head.html
BODY = body.html
FOOT = foot.html
@ -12,7 +21,7 @@ else
MEDIA_CMD = -a china-dictatorship-media-base='$(MEDIA)'
endif
$(OUT): README.adoc $(HEAD) $(FOOT) template_dir/*
$(OUT): $(IN) $(HEAD) $(FOOT) template_dir/*
@# --embedded + head/foot originally added to fix image height:
@# https://stackoverflow.com/questions/63464732/how-to-set-a-custom-image-height-for-an-image-in-asciidoctor
@#
@ -21,13 +30,21 @@ $(OUT): README.adoc $(HEAD) $(FOOT) template_dir/*
bundle exec asciidoctor \
$(MEDIA_CMD) \
--embedded \
--failure-level info \
-o $(BODY) \
--template-dir template_dir \
--trace \
-v \
$(OPTS) \
'$<'
cat $(HEAD) $(BODY) $(FOOT) > '$@'
multipage: $(OUT_MULTIPAGE)
$(OUT_MULTIPAGE): $(IN) template_dir/*
bundle exec asciidoctor \
-D '$(OUT_MULTIPAGE_DIR)' \
-a multipage-level=6 \
-b multipage_html5 \
-r asciidoctor-multipage \
$(OPTS) \
'$<'
clean:
rm -rf $(OUT) $(BODY)

12
push

@ -3,27 +3,33 @@
# https://github.com/cirosantilli/china-dictatorship#mirrors
set -eux
make
make multipage
git push --follow-tags
git push git@gitlab.com:cirosantilli/china-dictatorship.git
out_dir=out/
out_multipage_dir="${out_dir}/multipage"
# GitHub pages.
# One time initial setup.
# git checkout --orphan gh-pages
# and copy over https://github.com/cirosantilli/jekyll-min
gh_pages_dir=out/gh-pages
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"
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
fi
# GitLab pages
out_dir=out/
gl_pages_dir="${out_dir}/gl-pages"
if [ ! -d "$gl_pages_dir" ]; then
mkdir -p "${out_dir}"
@ -31,6 +37,8 @@ if [ ! -d "$gl_pages_dir" ]; then
fi
make MEDIA=https://gitlab.com/cirosantilli/china-dictatorship-media/-/raw/master OUT="${gl_pages_dir}/public/index.html"
cp .gitlab-ci.yml "${gl_pages_dir}"
cp "${out_multipage_dir}/"* "$gh_pages_dir"
mv "${gh_pages_dir}/README.html" "${gh_pages_dir}/index-split.html"
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

Loading…
Cancel
Save