-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (75 loc) · 2.43 KB
/
joss-pdf-build.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
name: joss-pdf-build
on:
push:
paths:
- paper/**
- .github/workflows/joss-pdf-build.yml
jobs:
paper-build:
runs-on: ubuntu-latest
name: JOSS-paper-build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build draft PDF
uses: openjournals/openjournals-draft-action@master
with:
journal: joss
# This should be the path to the paper within your repo.
paper-path: paper/paper.md
- name: Upload
uses: actions/upload-artifact@v4
with:
name: paper
# This is the output path where Pandoc will write the compiled
# PDF. Note, this should be the same directory as the input
# paper.md
path: paper/paper.pdf
paper-add-to-repo:
runs-on: ubuntu-latest
name: add-pdf-to-repo
needs: paper-build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check if on protected branch
run: |
if [ "${GITHUB_REF##*/}" = "main" ]; then
echo "Warning: The pdf will not be commit to to the protected branch 'main'. You should do this manuallly if on main."
exit 1
fi
shell: bash
- name: If exists the paper file paper/paper.pdf, remove it
run: |
if [ -f paper/paper.pdf ]; then
rm paper/paper.pdf
else
echo "File paper/paper.pdf does not exist."
fi
shell: bash
- name: Download
uses: actions/download-artifact@v4
with:
name: paper
path: paper
- name: Install GitHub CLI
run: |
sudo apt-get update
sudo apt-get install -y gh
- name: Authenticate GitHub CLI
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: Get current branch name
run: |
current_branch=$(git branch --show-current)
echo "Current branch: $current_branch"
shell: bash
- name: Create new branch and commit pdf addtion/replacement
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add paper/paper.pdf
git commit -m "ACTION_BOT: AC JOSS paper draft PDF"
git push --set-upstream origin $current_branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}