Skip to content

Commit

Permalink
update workflow to automate bibtex references update
Browse files Browse the repository at this point in the history
add script to update the zotero references #28
export zip archive instead tar.gz #25
  • Loading branch information
prudhomm committed Oct 24, 2024
1 parent cd1356e commit 2132ab3
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions .github/workflows/latex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
id: texlive_runner
run: |
if ! [ -z "$GH_TOKEN" ]; then
runners=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/feelpp/actions/runners)
runners=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/${{ github.repository_owner }}/actions/runners)
texlive=$(echo $runners | jq --arg label "self-texlive" '[.runners[] | any(.labels[]; .name == $label) and .status == "online"] | any')
if [ "$texlive" = "false" ]; then
echo "runner=ubuntu-latest" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -60,16 +60,35 @@ jobs:
name: Build LaTeX Artifact
env:
VERSION: ${{ github.ref_name }}
ZOTERO_API_KEY: ${{ secrets.ZOTERO_API_KEY }}
steps:
- name: Set up Git repository
uses: actions/checkout@v4
with:
clean: true

- name: Install hooks
- name: Install hooks
run: |
bash ./a.cli setup
- name: Update BibTeX references
if: ${{ github.ref != 'refs/heads/main' }}
run: |
bash ./a.cli update-bibtex
- name: Commit new references.bib
if: ${{ github.ref != 'refs/heads/main' }}
run: |
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
git config --local user.name "${{ github.actor }}"
git add references.bib
if ! git diff --cached --quiet; then
git commit -m "Update references.bib from Zotero"
git push
else
echo "No changes in references.bib to commit."
fi
- name: Compile LaTeX document
uses: xu-cheng/latex-action@v3
if: ${{ needs.workflow-setup.outputs.runner == 'ubuntu-latest' }}
Expand Down Expand Up @@ -97,10 +116,18 @@ jobs:
./*.bbl
./${{ needs.workflow-setup.outputs.pdf }}
./README.adoc
./hooks*
./img*
./dat*
./*.png
./a.cli
./*.sty
./chapters*
./software*
./exclude.txt
./sections*
./litterature*
./graphics*
!./.git*
!./.github*
!./.vscode*
Expand Down Expand Up @@ -152,11 +179,12 @@ jobs:
- name: Archive Article
run: |
temp_dir=$(mktemp -d)
# tar -czvf "${temp_dir}/${{ needs.workflow-setup.outputs.prefixwithref }}.tar.gz" -C artifact ./
# mv "${temp_dir}/${{ needs.workflow-setup.outputs.prefixwithref }}.tar.gz" ./
cd artifact
zip -r "${temp_dir}/${{ needs.workflow-setup.outputs.prefixwithref }}.zip" ./
cd ..
mv "${temp_dir}/${{ needs.workflow-setup.outputs.prefixwithref }}.zip" ./
rm -rf "$temp_dir"
rm -rf "$temp_dir"
- name: Create Release
id: create_release
Expand Down

0 comments on commit 2132ab3

Please sign in to comment.