forked from AtChem/AtChem2
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (80 loc) · 3.18 KB
/
tex.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# -----------------------------------------------------------------------------
#
# Copyright (c) 2017 Sam Cox, Roberto Sommariva
#
# This file is part of the AtChem2 software package.
#
# This file is covered by the MIT license which can be found in the file
# LICENSE.md at the top level of the AtChem2 distribution.
#
# -----------------------------------------------------------------------------
# Workflow to generate automatically the pdf file of the AtChem2 manual
# -------------------------------------------------------------------- #
name: AtChem2 PDF
# ------------------------------ EVENTS ------------------------------ #
# Controls when the workflow is activated
on:
# Triggers when a pull request is created or updated (only on the
# master branch), and the .tex/.svg files modified
pull_request:
branches: [ master ]
# paths:
# - './doc/latex/*.tex'
# - './doc/figures/*.svg'
# Triggers when a push is made to the master branch (either by
# merging a pull request, or by direct commit)
# push:
# branches: [ master ]
# Run manually from the Actions tab
# workflow_dispatch:
# ------------------------------ JOBS ------------------------------ #
# This workflow contains a single job called `pdf_manual` which sets
# up a full TeXLive environment, compiles the source files, and
# generates the pdf file of the manual
jobs:
pdf_manual:
# The job runs on the latest version of linux (ubuntu)
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# -------------------------------------------------------------
# 1. Checkout the repository from the branch associated with the
# current Pull Request
- name: Checkout repo
uses: actions/checkout@v4 # https://github.com/marketplace/actions/checkout
with:
fetch-depth: 2
ref: ${{ github.ref }}
echo "------> ${{ github.ref }}"
# -------------------------------------------------------------
# 2. Setup TeXLive and Inkscape (v1.x), then run the script
# `tools/make_manual_pdf.sh`
- name: Setup TexLive and compile the manual
uses: xu-cheng/texlive-action@v2 # https://github.com/marketplace/actions/github-action-with-texlive
with:
scheme: small
run: |
apk add inkscape
./tools/make_manual_pdf.sh
# -------------------------------------------------------------
# 3.
- name: Upload pdf file as artifact
uses: actions/upload-artifact@v4 # https://github.com/marketplace/actions/upload-a-build-artifact
with:
name: AtChem2-Manual.pdf
path: doc/AtChem2-Manual.pdf
# -------------------------------------------------------------
# 4.
- name: Add pdf to PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# configure git
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
# commit pdf file
git status
# git add doc/AtChem2-Manual.pdf
# git commit -m "Update AtChem2-Manual.pdf"
# git push origin HEAD:${{ github.ref }}