Merge branch 'joss_paper' of https://github.com/ibois-epfl/augmented-… #491
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |