From e9841c24c113141f98bfd08f3d4ab318fca4eca1 Mon Sep 17 00:00:00 2001 From: yumetodo Date: Thu, 19 Mar 2020 10:28:07 +0900 Subject: [PATCH 1/7] fix: img path hack is not required this hack is broken --- build/gen.sh | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) 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" From 85675fcffce5e13cff9ebc0641d9c362e6b1c896 Mon Sep 17 00:00:00 2001 From: yumetodo Date: Thu, 19 Mar 2020 10:45:14 +0900 Subject: [PATCH 2/7] feat(ci): init github actions --- .github/workflows/build.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..295f75e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,23 @@ +name: build + +on: + push: + branches: + - master +jobs: + env: + IN_FILE: opus-iso-binding.md + OUT_FILE_NAME: opus-iso-binding + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-ruby@v1 + with: + ruby-version: 2.7 + - run: sudo gem install kramdown + - run: kramdown --template build/html-template ${{ IN_FILE }} > ${{ OUT_FILE_NAME }}.html + - run: | + docker run --security-opt seccomp=unconfined \ + --rm -v $(pwd):/converted/ arachnysdocker/athenapdf athenapdf --no-cache \ + ${{ OUT_FILE_NAME }}.html ${{ OUT_FILE_NAME }}.pdf From 24b7abd876e4e0f38adb60bdc873b64ac3bebe2e Mon Sep 17 00:00:00 2001 From: yumetodo Date: Thu, 19 Mar 2020 10:47:34 +0900 Subject: [PATCH 3/7] fix(ci): env decleation position was wrong --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 295f75e..d26df78 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,11 +5,11 @@ on: branches: - master jobs: - env: - IN_FILE: opus-iso-binding.md - OUT_FILE_NAME: opus-iso-binding build: runs-on: ubuntu-latest + env: + IN_FILE: opus-iso-binding.md + OUT_FILE_NAME: opus-iso-binding steps: - uses: actions/checkout@v2 - uses: actions/setup-ruby@v1 From f012ae0f9274289f833b403e11e3c0860fd3fd18 Mon Sep 17 00:00:00 2001 From: yumetodo Date: Thu, 19 Mar 2020 10:53:59 +0900 Subject: [PATCH 4/7] fix(ci): env usage --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d26df78..3b9ea1a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,8 +16,8 @@ jobs: with: ruby-version: 2.7 - run: sudo gem install kramdown - - run: kramdown --template build/html-template ${{ IN_FILE }} > ${{ OUT_FILE_NAME }}.html + - run: kramdown --template build/html-template ${{ env.IN_FILE }} > ${{ env.OUT_FILE_NAME }}.html - run: | docker run --security-opt seccomp=unconfined \ --rm -v $(pwd):/converted/ arachnysdocker/athenapdf athenapdf --no-cache \ - ${{ OUT_FILE_NAME }}.html ${{ OUT_FILE_NAME }}.pdf + ${{ env.OUT_FILE_NAME }}.html ${{ env.OUT_FILE_NAME }}.pdf From df06fe9e4e04ad40f09f7fe07d42eda7211cb303 Mon Sep 17 00:00:00 2001 From: yumetodo Date: Thu, 19 Mar 2020 17:58:48 +0900 Subject: [PATCH 5/7] fix(ci): uplaod to gh-pages --- .github/workflows/build.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3b9ea1a..046528c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,9 +15,23 @@ jobs: - uses: actions/setup-ruby@v1 with: ruby-version: 2.7 - - run: sudo gem install kramdown - - run: kramdown --template build/html-template ${{ env.IN_FILE }} > ${{ env.OUT_FILE_NAME }}.html - - run: | + - 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 /tmp/deploy + [[ -d images ]] && cp -r images /tmp/deploy/ + cp ${{ env.OUT_FILE_NAME }}.html /tmp/deploy/ + cp ${{ env.OUT_FILE_NAME }}.pdf /tmp/deploy/ + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: /tmp/deploy/ From 0ed3c0290030b9ac544909edded5cbcf092e4bda Mon Sep 17 00:00:00 2001 From: yumetodo Date: Thu, 19 Mar 2020 19:05:26 +0900 Subject: [PATCH 6/7] fix(ci): peaceiris/actions-gh-pages@v3 doesn't accept absolute path --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 046528c..6268bfd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,12 +26,12 @@ jobs: ${{ env.OUT_FILE_NAME }}.html ${{ env.OUT_FILE_NAME }}.pdf - name: Gather deploy files run: | - mkdir -p /tmp/deploy - [[ -d images ]] && cp -r images /tmp/deploy/ - cp ${{ env.OUT_FILE_NAME }}.html /tmp/deploy/ - cp ${{ env.OUT_FILE_NAME }}.pdf /tmp/deploy/ + 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: /tmp/deploy/ + publish_dir: ./deploy/ From f0207c6cec88cbe916acdec299bb73aa69055938 Mon Sep 17 00:00:00 2001 From: yumetodo Date: Thu, 19 Mar 2020 19:23:45 +0900 Subject: [PATCH 7/7] fix(ci): cut out ruby version to env --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6268bfd..3138ab5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,11 +10,12 @@ jobs: 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: 2.7 + ruby-version: ${{ env.RUBY_VERSION }} - name: install kramdown run: sudo gem install kramdown - name: Convert Markdown to HTML