From 4b73fd0fe65112a8696b6c622e3da8d47e57b2e5 Mon Sep 17 00:00:00 2001 From: Mireille LOUYS <33840665+loumir@users.noreply.github.com> Date: Wed, 29 Apr 2026 17:06:03 +0200 Subject: [PATCH] add preview workflow --- preview.yml | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 preview.yml diff --git a/preview.yml b/preview.yml new file mode 100644 index 0000000..267fb97 --- /dev/null +++ b/preview.yml @@ -0,0 +1,74 @@ +# This file generated from a template file maintained in the ivoatex repository. +# To create and install it into a project repository, do: +# make github-preview +# git commit +# git push +# +name: Update PDF Preview + +env: + doc_name : ObsCoreExtensionForRadioData + branch_name: ${{ github.head_ref || github.ref_name }} + tag_preview: auto-pdf-preview + +on: + push: + branches: + - main + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + + - name: Checkout the repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup dependencies + run: | + sudo apt update + sudo apt install texlive-latex-base texlive-latex-recommended \ + texlive-latex-extra texlive-fonts-recommended \ + librsvg2-bin latexmk \ + pdftk xsltproc latexmk cm-super + + - name: Build the document + run: make ${{ env.doc_name }}-draft.pdf + + - name: Check the output + run: | + test -f ${{ env.doc_name }}-draft.pdf + test -f ${{ env.doc_name }}.bbl + + - name: Remove the former PDF preview (if any) + run: | + existingTag=$( gh release list --exclude-drafts --json 'isPrerelease,tagName' \ + --jq '.[] | select(.isPrerelease == true and .tagName == "${{ env.tag_preview }}") | .tagName' \ + | xargs -n 1 echo ) + if [ -n "$existingTag" ]; + then + gh release delete --cleanup-tag "$existingTag" + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload the new PDF preview + run: | + RELEASE_NOTES="This release aims to provide a PDF preview of the last commit applied on this repository. + It will be updated automatically after each merge of a PullRequest. + **DO NOT PUBLISH THIS PRE-RELEASE!** + _Corresponding commit: ${{ github.sha }}_" + + gh release create ${{ env.tag_preview }} \ + ${{ env.doc_name }}-draft.pdf \ + --prerelease \ + --target "${{ env.branch_name }}" \ + --title 'Auto PDF Preview' \ + --notes "$RELEASE_NOTES" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} +