add comment #14
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
name: Convert Markdown to PDF and Release | |
on: | |
push: | |
branches: | |
- release-pdf | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- name: Install dependencies | |
run: npm install | |
- name: Install pandoc | |
run: sudo apt-get install pandoc | |
- name: Install latex with xelatex | |
run: sudo apt-get install texlive-base texlive-xetex | |
- name: Add pdflatex to PATH | |
run: echo "export PATH=$PATH:/usr/bin/pdflatex" >> $GITHUB_ENV | |
- name: Install additional latex packages | |
run: sudo apt-get install texlive-latex-extra | |
- name: Install ctex | |
run: sudo apt-get install texlive-lang-chinese | |
- name: Install fonts | |
run: sudo apt-get install texlive-fonts-recommended texlive-fonts-extra ttf-mscorefonts-installer | |
- name: Convert Markdown to PDF with xelatex | |
run: | | |
mkdir -p pdfs | |
find . -name "*.md" | while IFS= read -r file; do | |
pandoc "$file" -o "pdfs/$(basename "$file" .md).pdf" --pdf-engine=xelatex --template=template/my_template.latex | |
done | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v1.0.0 | |
release_name: Release v1.0.0 | |
body: | | |
This is the release description. | |
draft: false | |
prerelease: false | |
- name: Upload PDFs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: pdfs | |
path: pdfs |