|
| 1 | +name: Build documentation |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + pull_request: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + pages: write |
| 12 | + id-token: write |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: "refman" |
| 16 | + cancel-in-progress: false |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v6 |
| 25 | + |
| 26 | + - name: Set up Node.js |
| 27 | + uses: actions/setup-node@v6 |
| 28 | + with: |
| 29 | + node-version: "20" |
| 30 | + |
| 31 | + - name: Install npm dependencies |
| 32 | + run: | |
| 33 | + make -C doc ecproof-deps |
| 34 | +
|
| 35 | + - name: Set up Python |
| 36 | + uses: actions/setup-python@v6 |
| 37 | + with: |
| 38 | + python-version: "3.13" |
| 39 | + |
| 40 | + - name: Install Python dependencies |
| 41 | + run: | |
| 42 | + make -C doc sphinx-deps |
| 43 | +
|
| 44 | + - name: Set-up OCaml |
| 45 | + uses: ocaml/setup-ocaml@v3 |
| 46 | + with: |
| 47 | + ocaml-compiler: 5.4 |
| 48 | + opam-disable-sandboxing: true |
| 49 | + dune-cache: true |
| 50 | + |
| 51 | + - name: Install EasyCrypt dependencies |
| 52 | + run: | |
| 53 | + opam pin add -n easycrypt . |
| 54 | + opam install --deps-only --depext-only --confirm-level=unsafe-yes easycrypt |
| 55 | + opam install --deps-only easycrypt |
| 56 | +
|
| 57 | + - name: Compile & Install EasyCrypt |
| 58 | + run: | |
| 59 | + opam exec -- make PROFILE=release install |
| 60 | +
|
| 61 | + - name: Build Sphinx HTML |
| 62 | + run: | |
| 63 | + opam exec -- make -C doc ecproof-bundle sphinx-html |
| 64 | +
|
| 65 | + - name: Upload documentation (artifact) |
| 66 | + uses: actions/upload-artifact@v6 |
| 67 | + with: |
| 68 | + name: refman |
| 69 | + path: doc/_build/html |
| 70 | + |
| 71 | + deploy: |
| 72 | + runs-on: ubuntu-latest |
| 73 | + needs: build |
| 74 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 75 | + |
| 76 | + steps: |
| 77 | + - name: Download documentation (artifact) |
| 78 | + uses: actions/download-artifact@v7 |
| 79 | + with: |
| 80 | + name: refman |
| 81 | + path: _refman |
| 82 | + |
| 83 | + - name: Deploy documentation |
| 84 | + env: |
| 85 | + PAGES_TOKEN: ${{ secrets.PAGES_REPO_TOKEN }} |
| 86 | + PAGES_REPO: EasyCrypt/refman |
| 87 | + TARGET_DIR: refman |
| 88 | + BUILD_DIR: _refman |
| 89 | + |
| 90 | + run: | |
| 91 | + set -euo pipefail |
| 92 | +
|
| 93 | + git config --global user.name "github-actions[bot]" |
| 94 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 95 | +
|
| 96 | + git clone --depth 1 https://x-access-token:${PAGES_TOKEN}@github.com/${PAGES_REPO}.git pages-repo |
| 97 | +
|
| 98 | + rm -rf "pages-repo/${TARGET_DIR}" |
| 99 | + mkdir -p "pages-repo/${TARGET_DIR}" |
| 100 | + touch "pages-repo/${TARGET_DIR}"/.keep |
| 101 | +
|
| 102 | + cp -a "${BUILD_DIR}/." "pages-repo/${TARGET_DIR}/" |
| 103 | +
|
| 104 | + git -C pages-repo add -A |
| 105 | +
|
| 106 | + if git -C pages-repo diff --cached --quiet; then |
| 107 | + echo "No changes to deploy." |
| 108 | + exit 0 |
| 109 | + fi |
| 110 | +
|
| 111 | + git -C pages-repo commit -m "Update docs: ${GITHUB_REPOSITORY}@${GITHUB_SHA}" |
| 112 | + git -C pages-repo push origin main |
0 commit comments