diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml new file mode 100644 index 0000000..104dcde --- /dev/null +++ b/.github/workflows/auto-release.yml @@ -0,0 +1,89 @@ +name: Build and Release LaTeX document + +on: + workflow_dispatch: + inputs: + tag_name: + description: release tag name + required: false + schedule: + - cron: "0 0 * * 0" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build the LaTeX document + uses: xu-cheng/latex-action@v2 + with: + latexmk_use_xelatex: true + latexmk_shell_escape: true + args: "-pdf -file-line-error -halt-on-error -interaction=nonstopmode -8bit" + extra_system_packages: | + unzip + wget + curl + coreutils + nodejs + npm + imagemagick + libwebp + librsvg + git + py3-pygments + inkscape + libxml2 + pre_compile: | + wget -q -O notosans.zip "https://noto-website-2.storage.googleapis.com/pkgs/NotoSans-hinted.zip" + wget -q -O notoserif.zip "https://noto-website-2.storage.googleapis.com/pkgs/NotoSerif-hinted.zip" + wget -q -O notoserifcjk.zip "https://noto-website-2.storage.googleapis.com/pkgs/NotoSerifCJKsc-hinted.zip" + wget -q -O notosanscjk.zip "https://noto-website-2.storage.googleapis.com/pkgs/NotoSansCJKsc-hinted.zip" + wget -q -O robotomono.zip "https://fonts.google.com/download?family=Roboto%20Mono" + wget -q "http://mirrors.ctan.org/fonts/cm-unicode.zip" + unzip -q notosans.zip -d notosans + unzip -q notoserif.zip -d notoserif + unzip -q notosanscjk.zip -d notosanscjk + unzip -q notoserifcjk.zip -d notoserifcjk + unzip -q robotomono.zip -d robotomono + unzip ./cm-unicode.zip + cp -r notosans notoserif notosanscjk notoserifcjk robotomono cm-unicode/fonts/otf/* /usr/share/fonts + fc-cache + cd remark-latex + npm i + cd .. + cd run + npm i + git clone https://github.com/The-Run-Philosophy-Organization/run.git + node index.js ./run + + root_file: | + run.tex + - name: create tag + id: create_tag + run: | + tag_name=$(TZ="Asia/Shanghai" date +"v%Y%m%d_%H%M") + if [[ -n "${{github.event.inputs.tag_name}}" ]]; then tag_name=${{github.event.inputs.tag_name}}; fi + git tag $tag_name + git push --tags + echo "::set-output name=tag_name::$tag_name" + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.create_tag.outputs.tag_name }} + release_name: Release ${{ steps.create_tag.outputs.tag_name }} + draft: false + prerelease: false + - name: Upload Release Asset + id: upload_release_asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./run/run.pdf + asset_name: run.pdf + asset_content_type: application/pdf