-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7963a0a
commit 658f505
Showing
8 changed files
with
193 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,57 +17,91 @@ on: | |
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
reviewdog-github-check: | ||
name: reviewdog (github-check) | ||
runs-on: ubuntu-latest | ||
# reviewdog-github-check: | ||
# name: reviewdog (github-check) | ||
# runs-on: ubuntu-latest | ||
|
||
steps: | ||
#reviewdogのアクション | ||
- uses: reviewdog/action-setup@v1 | ||
with: | ||
reviewdog_version: latest | ||
# steps: | ||
# #reviewdogのアクション | ||
# - uses: reviewdog/action-setup@v1 | ||
# with: | ||
# reviewdog_version: latest | ||
|
||
#textlintを動かすためのnodeアクション | ||
- uses: actions/setup-node@v2 | ||
# #textlintを動かすためのnodeアクション | ||
# - uses: actions/setup-node@v3 | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
# - name: Checkout repository | ||
# uses: actions/checkout@v3 | ||
# with: | ||
# submodules: recursive | ||
|
||
- name: cache-node-modules | ||
#stepsが失敗(文章の乱れ)した場合でもcacheを取得するようにする | ||
uses: pat-s/[email protected] | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.npm | ||
key: node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
node- | ||
# - name: cache-node-modules | ||
# #stepsが失敗(文章の乱れ)した場合でもcacheを取得するようにする | ||
# uses: pat-s/[email protected] | ||
# env: | ||
# cache-name: cache-node-modules | ||
# with: | ||
# path: ~/.npm | ||
# key: node-${{ hashFiles('**/package-lock.json') }} | ||
# restore-keys: | | ||
# node- | ||
|
||
- name: Install textlint | ||
run: 'npm install --save-dev textlint textlint-rule-preset-smarthr textlint-rule-prh textlint-plugin-review' | ||
# - name: Install textlint | ||
# run: 'npm install --save-dev textlint textlint-rule-preset-smarthr textlint-rule-prh textlint-plugin-review' | ||
|
||
- name: Install dependent module | ||
run: npm install | ||
# - name: Install dependent module | ||
# run: npm install | ||
|
||
- name: Execute textlint | ||
env: | ||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
npx textlint -f checkstyle chapter/*.re wiki/*.md README.md \ | ||
| reviewdog -f=checkstyle -name="textlint" -diff="git diff ${{ github.event.pull_request.base.ref }}" -reporter=github-pr-review -level="error" | ||
# - name: Execute textlint | ||
# env: | ||
# REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# run: | | ||
# npx textlint -f checkstyle chapter/*.re wiki/*.md README.md \ | ||
# | reviewdog -f=checkstyle -name="textlint" -diff="git diff ${{ github.event.pull_request.base.ref }}" -reporter=github-pr-review -level="error" | ||
|
||
pdf: | ||
needs: reviewdog-github-check | ||
name: Make PDF | ||
paper: | ||
# needs: reviewdog-github-check | ||
name: Make PDF for Paper | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ghcr.io/huideyeren/review-docker:main | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
- name: Install gems. | ||
run: bundle install | ||
- name: Copy plantuml. | ||
run: cp /java/plantuml.jar . | ||
- name: Check tools | ||
run: dot -V && blockdiag --version && java -jar plantuml.jar -version | ||
- name: convert PlantUML | ||
run: pwd | bash ./plantuml.sh >> .plantuml.log | ||
- name: Show .plantuml.log | ||
run: cat .plantuml.log | ||
- name: Convert SVG to PDF | ||
run: pwd | python3 svg.py >> .svg.log | ||
- name: Show .svg.log | ||
run: cat .svg.log | ||
- name: Grayscaling images. | ||
run: pwd | python3 grayscaling.py >> .grayscaling.log | ||
- name: Show .grayscaling.log | ||
run: cat .grayscaling.log | ||
- name: Build PDF. | ||
run: REVIEW_CONFIG_FILE=config-print-pdf.yml bundle exec rake pdf | ||
- name: Upload artifact. | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: book.pdf | ||
path: book.pdf | ||
pdf-ebook: | ||
# needs: reviewdog-github-check | ||
name: Make PDF for Ebook | ||
runs-on: ubuntu-latest | ||
container: | ||
image: huideyeren/review | ||
image: ghcr.io/huideyeren/review-docker:main | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Install gems. | ||
run: bundle install | ||
- name: Copy plantuml. | ||
|
@@ -82,26 +116,22 @@ jobs: | |
run: pwd | python3 svg.py >> .svg.log | ||
- name: Show .svg.log | ||
run: cat .svg.log | ||
# - name: Rotate images. | ||
# run: pwd | python3 rotate.py >> .rotate.log | ||
# - name: Show .rotate.log | ||
# run: cat .rotate.log | ||
- name: Build PDF. | ||
run: bundle exec rake clean pdf | ||
run: REVIEW_CONFIG_FILE=config-ebook-pdf.yml REVIEW_CATALOG_FILE=catalog-download.yml bundle exec rake pdf | ||
- name: Upload artifact. | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: book.pdf | ||
path: book.pdf | ||
epub: | ||
needs: reviewdog-github-check | ||
# needs: reviewdog-github-check | ||
name: Make EPUB | ||
runs-on: ubuntu-latest | ||
container: | ||
image: huideyeren/review | ||
image: ghcr.io/huideyeren/review-docker:main | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Install gems. | ||
run: bundle install | ||
- name: Copy plantuml. | ||
|
@@ -113,9 +143,9 @@ jobs: | |
- name: Show .plantuml.log | ||
run: cat .plantuml.log | ||
- name: Build EPUB. | ||
run: bundle exec rake clean epub | ||
run: REVIEW_CONFIG_FILE=config-epub.yml REVIEW_CATALOG_FILE=catalog-download.yml bundle exec rake epub | ||
- name: Upload artifact. | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: book.epub | ||
path: book.epub | ||
path: book.epub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
PREDEF: | ||
- preface.re | ||
|
||
CHAPS: | ||
- test.re | ||
|
||
APPENDIX: | ||
|
||
POSTDEF: | ||
- postscript.re | ||
- bib.re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
inherit: ["config.yml"] | ||
page_metric: A5 | ||
catalogfile: catalog-download.yml | ||
# backcover: backcover.tex | ||
# bookname: louisa-works-2023-2-ebook | ||
texdocumentclass: ["review-jlreq", "media=ebook,paper=a5,fontsize=10pt,serial_pagination=true,tate,twoside,onecolumn"] | ||
# pdfmaker: | ||
# coverimage: c103frontcover.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
inherit: ["config.yml"] | ||
catalogfile: catalog-download.yml | ||
# bookname: louisa-works-2023-2-epub | ||
# coverimage: c103frontcover.png | ||
# backcover: C103backcover.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
inherit: ["config.yml"] | ||
# bookname: louisa-works-2023-2-print | ||
# prt: ねこのしっぽ | ||
texdocumentclass: ["review-jlreq", "media=print,paper=b5,fontsize=9pt,serial_pagination=true,hiddenfolio=shippo,startpage=3,tate,twoside,onecolumn,openany"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Copyright (c) 2020 Kenshi Muto | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in | ||
# all copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
# THE SOFTWARE. | ||
|
||
require 'fileutils' | ||
require 'yaml' | ||
|
||
def make_mdre(ch, p2r, path) | ||
basedir = 'chapter/' | ||
source = basedir + ch | ||
if File.exist?(source) # re file | ||
FileUtils.cp(source, path) | ||
elsif File.exist?(source.sub(/\.re\Z/, '.md')) # md file | ||
system("#{p2r} #{source.sub(/\.re\Z/, '.md')} > #{path}/#{ch}") | ||
end | ||
end | ||
|
||
desc 'run pandoc2review' | ||
task :pandoc2review do | ||
path = '_refiles' | ||
p2r = 'pandoc2review' | ||
if File.exist?('../../pandoc2review') | ||
p2r = '../../pandoc2review' | ||
end | ||
|
||
unless File.exist?(path) | ||
Dir.mkdir(path) | ||
File.write("#{path}/THIS_FOLDER_IS_TEMPORARY", '') | ||
end | ||
|
||
catalog = YAML.load_file(ENV['REVIEW_CATALOG_FILE'] || 'catalog.yml') | ||
%w(PREDEF CHAPS APPENDIX POSTDEF).each do |block| | ||
if catalog[block].kind_of?(Array) | ||
catalog[block].each do |ch| | ||
if ch.kind_of?(Hash) # Parts | ||
ch.each_pair do |k, v| | ||
make_mdre(k, p2r, path) | ||
# Chapters | ||
v.each {|subch| make_mdre(subch, p2r, path) } | ||
end | ||
elsif ch.kind_of?(String) # Chapters | ||
make_mdre(ch, p2r, path) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
CLEAN.include('_refiles') | ||
Rake::Task[BOOK_PDF].enhance([:pandoc2review]) | ||
Rake::Task[BOOK_EPUB].enhance([:pandoc2review]) | ||
Rake::Task[WEBROOT].enhance([:pandoc2review]) | ||
Rake::Task[TEXTROOT].enhance([:pandoc2review]) | ||
Rake::Task[TOPROOT].enhance([:pandoc2review]) | ||
Rake::Task[IDGXMLROOT].enhance([:pandoc2review]) |