|
| 1 | +name: Ximera Workflow |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + # tags: |
| 6 | + # - 'v*' # Trigger the workflow when a new tag starting with 'v' is pushed |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-ximera: |
| 10 | + name: Build and preview Ximera Courses |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + permissions: |
| 14 | + actions: read |
| 15 | + contents: read |
| 16 | + packages: write |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + fetch-depth: 0 # full |
| 23 | + |
| 24 | + - name: Setup cache |
| 25 | + uses: actions/cache@v4 |
| 26 | + with: |
| 27 | + path: | |
| 28 | + **/*.html |
| 29 | + **/*.pdf |
| 30 | + **/*.svg |
| 31 | + **/*.aux |
| 32 | + **/*.xref |
| 33 | + **/*.toc |
| 34 | + !xmPictures/** |
| 35 | + !.git/** |
| 36 | + !.github/** |
| 37 | + key: ximera-${{ github.ref_name }}-${{ github.sha }} |
| 38 | + restore-keys: | |
| 39 | + ximera-${{ github.ref_name }}- |
| 40 | + ximera- |
| 41 | +
|
| 42 | +
|
| 43 | + - name: Build and publish Ximera courses |
| 44 | + env: |
| 45 | + # These variables can/should be set at repository level |
| 46 | + # If not set, defaults from xmScripts/config.txt or xlatex will be used |
| 47 | + # (The defaults will presumably make this step fail.) |
| 48 | + GPG_KEY: ${{ secrets.GPG_KEY }} |
| 49 | + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} |
| 50 | + XIMERA_URL: ${{ vars.XIMERA_URL }} |
| 51 | + XIMERA_NAME: ${{ vars.XIMERA_NAME }}${{ github.ref_name }} |
| 52 | + run: | |
| 53 | + ls -alrt |
| 54 | + chmod +x xmScripts/xmlatex # Overleaf sync might reset it :-() |
| 55 | + ./xmScripts/xmlatex ghaction |
| 56 | + echo "✅ Published to $XIMERA_URL$XIMERA_NAME " >> $GITHUB_STEP_SUMMARY |
| 57 | +
|
| 58 | + - name: Setup ximera serve cache (only .git) |
| 59 | + id: serve-cache |
| 60 | + uses: actions/cache/save@v4 |
| 61 | + with: |
| 62 | + path: | |
| 63 | + xmScripts/** |
| 64 | + .git/** |
| 65 | + key: ximeraSERVE-${{ github.ref_name }}-${{ github.sha }} |
| 66 | + |
| 67 | + |
| 68 | + publish-ximera: |
| 69 | + name: Publish Ximera Courses |
| 70 | + needs: build-ximera # Waits for the build job to complete |
| 71 | + runs-on: ubuntu-latest |
| 72 | + environment: production # Allows for 'manual review' step |
| 73 | + steps: |
| 74 | + - name: Restore ximera serve cache (only .git) |
| 75 | + id: serve-cache-restore |
| 76 | + uses: actions/cache/restore@v4 |
| 77 | + with: |
| 78 | + fail-on-cache-miss: true |
| 79 | + path: | |
| 80 | + xmScripts/** |
| 81 | + .git/** |
| 82 | + key: ximeraSERVE-${{ github.ref_name }}-${{ github.sha }} |
| 83 | + |
| 84 | + - name: Serve |
| 85 | + env: |
| 86 | + GPG_KEY: ${{ secrets.GPG_KEY }} |
| 87 | + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} |
| 88 | + XIMERA_URL: ${{ vars.XIMERA_URL }} |
| 89 | + XIMERA_NAME: ${{ vars.XIMERA_NAME }} |
| 90 | + run: | |
| 91 | + chmod +x xmScripts/xmlatex # Overleaf sync might reset it :-() |
| 92 | + ./xmScripts/xmlatex name |
| 93 | + ./xmScripts/xmlatex serve -f # NOTE: -f should not be needed ... |
| 94 | + echo "✅ Published to $XIMERA_URL$XIMERA_NAME " >> $GITHUB_STEP_SUMMARY |
| 95 | +
|
| 96 | +
|
| 97 | +
|
0 commit comments