-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (52 loc) · 1.6 KB
/
main.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
name: PDF release (via LaTeX)
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get latest code
uses: actions/checkout@v2.3.2
- name: Compile LaTeX
uses: xu-cheng/latex-action@v2
with:
root_file: main.tex
args: -pdf -file-line-error -halt-on-error -interaction=nonstopmode
compiler: latexmk
- name: Upload PDF artifact
uses: actions/upload-artifact@v2
with:
name: pdf_file
path: main.pdf
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: [build]
steps:
- name: Set variables
id: vars
run: |
echo "::set-output name=date::$(date +'%Y-%m-%d')"
echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: pdf_file
- name: Create release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: main-${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha8 }}
release_name: Automatic build (version ${{ steps.vars.outputs.date }})
draft: false
prerelease: false
- name: Upload PDF asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./main.pdf
asset_name: main.pdf
asset_content_type: application/pdf