-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (70 loc) · 2.08 KB
/
test_build_release.yaml
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
name: Test CQ, build and release
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v2
- name: Test for trailing whitespace
uses: harupy/find-trailing-whitespace@master
- name: Check for missing newlines
uses: fernandrone/linelint@master
build:
needs: test
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v2
- name: Compile LaTeX document
uses: xu-cheng/latex-action@v2
with:
root_file: thesis.tex
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: thesis.pdf
path: thesis.pdf
if-no-files-found: error
release:
if: github.ref == 'refs/heads/master' # Releases go only from master
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Declare variables
id: vars
shell: bash
run: |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Create Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "autorelease-${{ steps.vars.outputs.sha_short }}"
release_name: "Automatic release from ${{ steps.vars.outputs.branch }}"
draft: false
prerelease: false
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: thesis.pdf
- name: Upload artifact to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: thesis.pdf
asset_name: thesis.pdf
asset_content_type: application/pdf