From cc9b6fd58f0221157b6196a2fdbfa31192226553 Mon Sep 17 00:00:00 2001 From: Jakub Wieczorek Date: Sat, 21 Sep 2024 13:32:37 +0200 Subject: [PATCH] Add a workflow to build and publish the documentation. --- .github/workflows/documentation.yml | 71 +++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/documentation.yml diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..76d84ac --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,71 @@ +name: Documentation + +on: + push: + branches: [main] + +permissions: + contents: read + pages: write + id-token: write + +env: + PROTOC_VERSION: 25.1 + +concurrency: + group: documentation + cancel-in-progress: true + +jobs: + build: + name: Build documentation + runs-on: ubuntu-latest + + steps: + - name: Install protoc + run: | + curl -LO "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip" + unzip "protoc-${PROTOC_VERSION}-linux-x86_64.zip" -d $HOME/.local + + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + - name: Configure cache + uses: Swatinem/rust-cache@v2 + + - name: Setup pages + uses: actions/configure-pages@v4 + + - name: Build the documentation + run: | + cargo clean --doc + cargo doc --no-deps + + - name: Add a redirect meta tag + run: echo '' > target/doc/index.html + + - name: Remove the lock file + run: rm target/doc/.lock + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: target/doc + + publish: + name: Publish documentation + environment: + name: Documentation + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4