|
| 1 | +name: Ximera Workflow |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +env: |
| 7 | + TEXMFHOME: /root/texmf # Should be set in xmlatex ! |
| 8 | + GPG_KEY: ${{ secrets.GPG_KEY }} |
| 9 | + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} |
| 10 | + # XIMERA_NAME: wimcalc20250905 |
| 11 | + # XIMERA_NAME: wimcalchints |
| 12 | + XIMERA_NAME: mooculuspreview |
| 13 | + XIMERA_URL: "https://ximera.osu.edu/" |
| 14 | + # XIMERA_URL: "https://xerxes.ximera.org/" |
| 15 | + # XM_TO_PROCESS: "testxourse.tex" |
| 16 | + # XM_TO_PROCESS: "testxourse.tex calculus*.tex calculus*TextbookBySection [a-z]*/exercises/exerciseList.tex" |
| 17 | + XM_TO_PROCESS: "." |
| 18 | + |
| 19 | + |
| 20 | +jobs: |
| 21 | + |
| 22 | + build-ximera-htmlexport: |
| 23 | + name: Run pdfexport and htmlexport |
| 24 | + runs-on: ubuntu-latest |
| 25 | + continue-on-error: true |
| 26 | + container: &x-container |
| 27 | + image: ghcr.io/ximeraproject/ximeralatex:v2.7.5fix2-full |
| 28 | + options: >- |
| 29 | + --workdir /code |
| 30 | + permissions: |
| 31 | + actions: read |
| 32 | + contents: read |
| 33 | + packages: write |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: "Prepare: Checkout code" |
| 37 | + uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + fetch-depth: 0 |
| 40 | + |
| 41 | + # Restore cache for cross-run speedup |
| 42 | + - name: "Prepare: Restore cache" |
| 43 | + uses: actions/cache/restore@v4 |
| 44 | + with: |
| 45 | + path: | |
| 46 | + **/*.pdf |
| 47 | + **/*.html |
| 48 | + **/*.aux |
| 49 | + **/*.log |
| 50 | + **/*.toc |
| 51 | + **/*.xref |
| 52 | + **/*.svg |
| 53 | + **/*.png |
| 54 | + !.git/** |
| 55 | + !.github/** |
| 56 | + key: ximeraPDFexport-${{ github.ref_name }}-${{ github.run_id }} |
| 57 | + restore-keys: | |
| 58 | + ximeraHTMLexport-${{ github.ref_name }}- |
| 59 | + ximeraPDFexport-${{ github.ref_name }}- |
| 60 | +
|
| 61 | + - name: "XIMERA: pdf and html (tikzexternalize/html)" |
| 62 | + run: | |
| 63 | + git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 64 | + mkdir -p .git/refs/heads |
| 65 | + [ -f ".git/refs/heads/master.tex" ] || date >".git/refs/heads/master.tex" |
| 66 | + echo "Add .xbb" |
| 67 | + ./xmScripts/add_xbb.sh . |
| 68 | + ls -alR understandingFunctions |
| 69 | + # xmlatex bake --compile pdfexport -j 5 $XM_TO_PROCESS |
| 70 | + xmlatex bake --compile htmlexport -j 5 $XM_TO_PROCESS |
| 71 | + du -hs ximera-downloads/* |
| 72 | + rm -rf ximera-downloads/pdfexport |
| 73 | +
|
| 74 | + # Save cache |
| 75 | + - name: "Postprocess: Save cache" |
| 76 | + uses: actions/cache/save@v4 |
| 77 | + with: |
| 78 | + path: | |
| 79 | + **/*.pdf |
| 80 | + **/*.html |
| 81 | + **/*.aux |
| 82 | + **/*.log |
| 83 | + **/*.toc |
| 84 | + **/*.xref |
| 85 | + **/*.svg |
| 86 | + **/*.png |
| 87 | + !.git/** |
| 88 | + !.github/** |
| 89 | + key: ximeraHTMLexport-${{ github.ref_name }}-${{ github.run_id }} |
| 90 | + |
| 91 | + # Upload artifact |
| 92 | + - name: "Postprocess: Save artifacts" |
| 93 | + uses: actions/upload-artifact@v4 |
| 94 | + with: |
| 95 | + name: htmlexport |
| 96 | + path: . |
| 97 | + |
| 98 | + serve-ximera-preview: |
| 99 | + name: "Run serve for (automatic) preview version" |
| 100 | + needs: build-ximera-htmlexport |
| 101 | + # continue-on-error: true |
| 102 | + runs-on: ubuntu-latest |
| 103 | + container: *x-container |
| 104 | + permissions: |
| 105 | + actions: read |
| 106 | + contents: read |
| 107 | + packages: write |
| 108 | + |
| 109 | + steps: |
| 110 | + - name: "Prepare: Checkout code" |
| 111 | + uses: actions/checkout@v4 |
| 112 | + with: |
| 113 | + fetch-depth: 0 |
| 114 | + |
| 115 | + # Download artifact from previous job |
| 116 | + - name: "Prepare: Checkout artifacts (from previous step)" |
| 117 | + uses: actions/download-artifact@v4 |
| 118 | + with: |
| 119 | + name: htmlexport |
| 120 | + path: . |
| 121 | + |
| 122 | + - name: "XIMERA: Serve PREVIEW version to ximeraserver" |
| 123 | + run: | |
| 124 | + echo "Serving to $XIMERA_URL$XIMERA_NAME" |
| 125 | + git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 126 | + # du -hs ximera-downloads |
| 127 | + # rm -rf ximera-downloads/* |
| 128 | + # du -hs . |
| 129 | + xmlatex name |
| 130 | + xmlatex frost $XM_TO_PROCESS |
| 131 | + xmlatex serve $XM_TO_PROCESS |
| 132 | + echo "✅ Published to $XIMERA_URL$XIMERA_NAME " |
| 133 | + echo "✅ Published to $XIMERA_URL$XIMERA_NAME " >> $GITHUB_STEP_SUMMARY |
| 134 | +
|
| 135 | + # - name: "Store artifacts" |
| 136 | + # uses: actions/upload-artifact@v4 |
| 137 | + # with: |
| 138 | + # name: serve |
| 139 | + # path: . |
| 140 | + |
| 141 | + publish-ximera: |
| 142 | + name: Run serve for public version |
| 143 | + needs: serve-ximera-preview |
| 144 | + runs-on: ubuntu-latest |
| 145 | + if: github.ref == 'refs/heads/main' |
| 146 | + continue-on-error: true |
| 147 | + container: *x-container |
| 148 | + environment: production |
| 149 | + |
| 150 | + steps: |
| 151 | + |
| 152 | + - name: Checkout code |
| 153 | + uses: actions/checkout@v4 |
| 154 | + with: |
| 155 | + fetch-depth: 0 |
| 156 | + |
| 157 | + # Download final artifact |
| 158 | + - name: Restore artifacts from previous job |
| 159 | + uses: actions/download-artifact@v4 |
| 160 | + with: |
| 161 | + name: htmlexport |
| 162 | + path: . |
| 163 | + |
| 164 | + - name: "XIMERA BUILD: Serve to ximeraserver (to public URL)" |
| 165 | + env: |
| 166 | + XIMERA_URL: "https://xerxes.ximera.org/" |
| 167 | + # XIMERA_URL: "https://ximera.osu.edu/" |
| 168 | + XIMERA_NAME: "mooculus" |
| 169 | + run: | |
| 170 | + echo "Serving to $XIMERA_URL$XIMERA_NAME" |
| 171 | + git config --global --add safe.directory /__w/calculus/calculus |
| 172 | + export TEXMFHOME=/root/texmf |
| 173 | + xmlatex name |
| 174 | + xmlatex serve -t $XM_TO_PROCESS |
| 175 | + # echo "Recent git log:" |
| 176 | + # git log --oneline --graph --decorate --all -n 10 |
| 177 | + echo "✅ Published to $XIMERA_URL$XIMERA_NAME " |
| 178 | + echo "✅ Published to $XIMERA_URL$XIMERA_NAME " >> $GITHUB_STEP_SUMMARY |
| 179 | +
|
0 commit comments