diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..3138ab5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: build + +on: + push: + branches: + - master +jobs: + build: + runs-on: ubuntu-latest + env: + IN_FILE: opus-iso-binding.md + OUT_FILE_NAME: opus-iso-binding + RUBY_VERSION: 2.7 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-ruby@v1 + with: + ruby-version: ${{ env.RUBY_VERSION }} + - name: install kramdown + run: sudo gem install kramdown + - name: Convert Markdown to HTML + run: kramdown --template build/html-template ${{ env.IN_FILE }} > ${{ env.OUT_FILE_NAME }}.html + - name: Convert HTML to PDF + run: | + docker run --security-opt seccomp=unconfined \ + --rm -v $(pwd):/converted/ arachnysdocker/athenapdf athenapdf --no-cache \ + ${{ env.OUT_FILE_NAME }}.html ${{ env.OUT_FILE_NAME }}.pdf + - name: Gather deploy files + run: | + mkdir -p deploy + [[ -d images ]] && cp -r images ./deploy/ + cp ${{ env.OUT_FILE_NAME }}.html ./deploy/ + cp ${{ env.OUT_FILE_NAME }}.pdf ./deploy/ + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./deploy/ diff --git a/build/gen.sh b/build/gen.sh index c583869..66cd349 100755 --- a/build/gen.sh +++ b/build/gen.sh @@ -6,23 +6,14 @@ outfile='opus-iso-binding' printf "\nConverting Markdown to HTML ...\n" -kramdown --template html-template ../${infile} | \ - # Change image path to parent, and make empty truly empty - sed -e 's/src="images/src="\.\.\/images/g' \ - -re 's|\xc2\xa0||g' \ - > ${outfile}.html +kramdown --template html-template ../${infile} > ${outfile}.html printf "\nHTML finished.\n\n" printf "\nConverting HTML to PDF ...\n\n" -## athenapdf can't handle filesystem paths -cp -r ../images . - docker run --security-opt seccomp=unconfined \ --rm -v $(pwd):/converted/ arachnysdocker/athenapdf athenapdf --no-cache \ ${outfile}.html ${outfile}.pdf -rm -rf images - printf "\nPDF finished.\n\n"