File tree Expand file tree Collapse file tree 10 files changed +68
-51
lines changed
Expand file tree Collapse file tree 10 files changed +68
-51
lines changed Original file line number Diff line number Diff line change 1515 steps :
1616 - uses : actions/checkout@v3
1717 - name : Build all courses
18- run : ./scripts/build_all.sh -o '${{ env.BUILD_DIRECTORY }}'
18+ run : |
19+ apk add --no-cache pandoc
20+ /bin/sh -x ./scripts/build_all.sh -o '${{ env.BUILD_DIRECTORY }}'
1921 - uses : actions/upload-artifact@v3
2022 with :
2123 name : ${{ env.RESULT_NAME }}
2224 path : ${{ env.BUILD_DIRECTORY }}
23- if-no-files-found : error
25+ if-no-files-found : error
Original file line number Diff line number Diff line change @@ -16,18 +16,16 @@ jobs:
1616 BUILD_DIRECTORY : ' build'
1717 steps :
1818 - uses : actions/checkout@v3
19- - name : Pull Container
20- run : |
21- docker pull asciidoctor/docker-asciidoctor:latest
2219 - name : Build all courses
2320 run : |
2421 docker run \
2522 --rm -v '${{ github.workspace }}':/documents \
26- asciidoctor/docker-asciidoctor \
27- ./scripts/build_all.sh -o '${{ env.BUILD_DIRECTORY }}' -s '${{ github.ref_name}}'
23+ asciidoctor/docker-asciidoctor:latest \
24+ /bin/sh -cx "apk add --no-cache pandoc; \
25+ ./scripts/build_all.sh -o '${{ env.BUILD_DIRECTORY }}' -s '${{ github.ref_name}}'"
2826 - name : Release all courses assets
2927 run : |
30- ./scripts/release_all.sh '${{ github.ref_name}}' \
28+ bash -x ./scripts/release_all.sh '${{ github.ref_name}}' \
3129 -o '${{ env.BUILD_DIRECTORY }}' \
3230 -s '${{ github.ref_name}}' \
3331 '${{ env.RELEASE_TITLE }}'
Original file line number Diff line number Diff line change 1+ ASCIIDOCTOR_PDF = asciidoctor-pdf
2+ ASCIIDOCTOR = asciidoctor
3+ PANDOC = pandoc
4+
5+ ROOT_ASCIIDOC_NAME = Course
6+
7+ CHAPTERS_DIR = Chapters
8+ CHAPTERS = $(wildcard $(CHAPTERS_DIR ) /* .adoc)
9+
10+ ROOT_ASCIIDOC = $(ROOT_ASCIIDOC_NAME ) .adoc
11+ RESULT_PDF = $(ROOT_ASCIIDOC_NAME ) .pdf
12+ RESULT_XML = $(ROOT_ASCIIDOC_NAME ) .xml
13+ RESULT_DOCX = $(ROOT_ASCIIDOC_NAME ) .docx
14+
15+ THEME = theme.yml
16+ REFERENCE = custom-reference.docx
17+ STYLE = tango
18+
19+ .PHONY : all
20+ all : $(RESULT_PDF ) $(RESULT_DOCX )
21+
22+ .PHONY : asciidoctor
23+ asciidoctor : $(RESULT_PDF ) $(RESULT_XML )
24+
25+ .PHONY : pandoc
26+ pandoc : $(RESULT_DOCX )
27+
28+ .PHONY : clean
29+ clean :
30+ $(RM ) $(RESULT_PDF ) $(RESULT_XML ) $(RESULT_DOCX )
31+
32+ $(RESULT_XML ) : $(ROOT_ASCIIDOC ) $(CHAPTERS )
33+ $(ASCIIDOCTOR ) \
34+ --backend docbook \
35+ --out-file=' $@' ' $<'
36+
37+ $(RESULT_DOCX ) : $(RESULT_XML ) $(REFERENCE )
38+ $(PANDOC ) \
39+ --from docbook \
40+ --reference-doc=$(REFERENCE ) \
41+ --highlight-style $(STYLE ) \
42+ --output ' $@' ' $<'
Original file line number Diff line number Diff line change 1- ASCIIDOCTOR_PDF = asciidoctor-pdf
2-
3- ROOT_ASCIIDOC_NAME = Course
4-
5- CHAPTERS_DIR = Chapters
6- CHAPTERS = $(wildcard $(CHAPTERS_DIR ) /* .adoc)
7-
8- ROOT_ASCIIDOC = $(ROOT_ASCIIDOC_NAME ) .adoc
9- RESULT_PDF = $(ROOT_ASCIIDOC_NAME ) .pdf
10-
11- THEME = theme.yml
12-
13- .PHONY : all
14- all : $(RESULT_PDF )
1+ include ../Common.mk
152
163$(RESULT_PDF ) : $(ROOT_ASCIIDOC ) $(CHAPTERS ) $(THEME )
174 $(ASCIIDOCTOR_PDF ) \
185 -r asciidoctor-mathematical \
196 -a mathematical-format=svg \
207 --theme $(THEME) \
218 --out-file='$@' '$<'
22-
23- .PHONY : clean
24- clean :
25- $(RM ) $(RESULT_PDF )
Original file line number Diff line number Diff line change 1- ASCIIDOCTOR_PDF = asciidoctor-pdf
2-
3- ROOT_ASCIIDOC_NAME = Course
4-
5- CHAPTERS_DIR = Chapters
6- CHAPTERS = $(wildcard $(CHAPTERS_DIR ) /* .adoc)
7-
8- ROOT_ASCIIDOC = $(ROOT_ASCIIDOC_NAME ) .adoc
9- RESULT_PDF = $(ROOT_ASCIIDOC_NAME ) .pdf
10-
11- THEME = theme.yml
12-
13- .PHONY : all
14- all : $(RESULT_PDF )
1+ include ../Common.mk
152
163$(RESULT_PDF ) : $(ROOT_ASCIIDOC ) $(CHAPTERS ) $(THEME )
174 $(ASCIIDOCTOR_PDF ) \
185 --theme $(THEME ) \
196 --out-file=' $@' ' $<'
20-
21- .PHONY : clean
22- clean :
23- $(RM ) $(RESULT_PDF )
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ Usage: $0 [OPTION]...
1212Build artifacts of the all courses
1313 -h, --help print this help message and exit
1414 -o, --out-dir DIRECTORY name of the DIRECTORY for all built artifacts
15- -s, --suffix SUFFIX SUFFIX for output pdf filename
15+ -s, --suffix SUFFIX SUFFIX for output filename
1616
1717Examples:
1818 $0
7979while IFS=" " read -r line || [ -n " $line " ]
8080do
8181 COURSE_NAME=$( get_info " $line " 1)
82- OUT_FILENAME=" $( get_info " $line " 2) $SUFFIX .pdf "
82+ OUT_FILENAME=" $( get_info " $line " 2) $SUFFIX "
8383
8484 " $BASEDIR /build_course.sh" -o " $BUILDDIR /$OUT_FILENAME " " $COURSE_NAME "
85+
8586done < " $COURSES "
Original file line number Diff line number Diff line change @@ -8,18 +8,19 @@ function usage() {
88Usage: $0 [OPTION] COURSE_NAME
99
1010Build artifacts of the course with COURSE_NAME
11- -o, --out FILENAME output pdf FILENAME
11+ -o, --out FILENAME output FILENAME without extension
1212 -h, --help print this help message and exit
1313
1414Examples:
1515 $0 LFD113x-RU
16- $0 -o 'Инструментарий_и_компиляторные_оптимизации_для_RISC-V_(LFD113x)_RU.pdf ' LFD113x-RU
16+ $0 -o 'Инструментарий_и_компиляторные_оптимизации_для_RISC-V_(LFD113x)_RU' LFD113x-RU
1717tac
1818}
1919
2020
2121# Parse arguments
2222COURSEDIR=" "
23+ FILENAME=" "
2324MAKEOPTS=()
2425
2526while [ " $1 " != " " ]; do
@@ -29,7 +30,7 @@ while [ "$1" != "" ]; do
2930 exit 0
3031 ;;
3132 -o|--out)
32- MAKEOPTS+=( " RESULT_PDF= $2 " )
33+ FILENAME= $2
3334 shift 2
3435 ;;
3536 -* )
@@ -56,5 +57,11 @@ if [ "$COURSEDIR" == "" ]; then
5657 exit 1
5758fi
5859
60+ if [ " $FILENAME " != " " ]; then
61+ MAKEOPTS+=(" RESULT_DOCX=${FILENAME} .docx" )
62+ MAKEOPTS+=(" RESULT_PDF=${FILENAME} .pdf" )
63+ MAKEOPTS+=(" RESULT_XML=${FILENAME} .xml" )
64+ fi
65+
5966# Build selected course
6067make -C " $COURSEDIR " " ${MAKEOPTS[@]} "
Original file line number Diff line number Diff line change 9292# Release all files in build directory
9393while IFS=" " read -r line || [ -n " $line " ]
9494do
95- OUT_FILENAME=" $( get_info " $line " 2) $SUFFIX .pdf "
95+ OUT_FILENAME=" $( get_info " $line " 2) $SUFFIX "
9696 LABEL=$( get_info " $line " 3)
9797
98- " $BASEDIR /release_file.sh" " $TAG " -t " $TITLE " " $BUILDDIR /$OUT_FILENAME " " $LABEL "
98+ " $BASEDIR /release_file.sh" " $TAG " -t " $TITLE " " $BUILDDIR /${OUT_FILENAME} .pdf" " ${LABEL} (pdf)"
99+ " $BASEDIR /release_file.sh" " $TAG " -t " $TITLE " " $BUILDDIR /${OUT_FILENAME} .docx" " ${LABEL} (docx)"
99100done < " $COURSES "
You can’t perform that action at this time.
0 commit comments