Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hamukazu committed May 29, 2023
1 parent f87f0c3 commit 9859b29
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 1 deletion.
62 changes: 62 additions & 0 deletions .github/workflows/actions-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: typeset
on:
push:
branches:
- main

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: get current date
id: date
run: |
echo "date=$(TZ=TIME_ZONE date +'%Y%m%d')" >$GITHUB_OUTPUT
- name: get counter
id: counter
run: |
LAST_RELEASE=$(gh release view --json=tagName | jq -r '.tagName')
LAST_DATE=$(echo $LAST_RELEASE|sed 's/-.*$//')
LAST_COUNTER=$(echo $LAST_RELEASE|sed 's/.*-*//')
if [ "$LAST_DATE" = "$DATE" ]
then
echo "counter=$(($LAST_COUNTER +1))" >$GITHUB_OUTPUT
else
echo "counter=1" >$GITHUB_OUTPUT
fi
env:
DATE: ${{ steps.date.outputs.date }}
GH_TOKEN: ${{ github.token }}
TIME_ZONE: JST-9 # Specify time zone here
- name: get version
id: version
run: |
echo "version=${{ steps.date.outputs.date }}-${{ steps.counter.outputs.counter }}" >$GITHUB_OUTPUT
- name: buildx
uses: docker/setup-buildx-action@v1
- name: build
run: docker-compose build
- name: run tex
run: docker-compose run tex
- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: Release ${{ steps.version.outputs.version }}
tag_name: ${{ steps.version.outputs.version }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: upload asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/sample.pdf # The resulting pdf file
asset_name: sample-${{ steps.version.outputs.version }}.pdf
asset_content_type: application/zip
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM blang/latex:ubuntu

RUN apt update -y
RUN apt install -y tzdata

RUN mkdir /work
RUN mkdir /work/build
COPY ./tex /work

WORKDIR /work

CMD sh ./build.sh
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# streamlined_latex_compilation
Book Writing Platform: Streamlined Latex Compilation

This is a sophisticated book writing platform. Whenever you push files to the main branch on GitHub, the system automatically compiles them and uploads the resulting PDF file to the release page.

The resulting PDF file is named in the following format: "sample-yyyymmdd-i", where "yyyymmdd" represents the date, and "i" is a sequential number within that date.

To give it a try, you can fork this project, make modifications to the included LaTeX file, and push your changes.
Empty file added build/.gitkeep
Empty file.
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
tex:
build: .
volumes:
- type: bind
source: ./build
target: /work/build

8 changes: 8 additions & 0 deletions tex/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
TEXFILE=sample.tex
FILE=${TEXFILE%.*}
TEX=lualatex
echo $FILE
$TEX $TEXFILE -interaction=nonstopmode
$TEX $TEXFILE -interaction=nonstopmode
$TEX $TEXFILE -interaction=nonstopmode
cp ${FILE}.pdf ./build
8 changes: 8 additions & 0 deletions tex/sample.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
\documentclass{article}
\usepackage[ipa]{luatexja-preset}
\title{Sample}
\author{Kimikazu Kato}
\begin{document}
\maketitle
これはサンプルです。
\end{document}

0 comments on commit 9859b29

Please sign in to comment.