Skip to content

fix: do not change directory to repo-root #741

fix: do not change directory to repo-root

fix: do not change directory to repo-root #741

Workflow file for this run

name: Docs
on:
push:
branches: [main]
paths:
- docs/**
- .github/workflows/build-docs.yml
- cpp-linter/src/**
- '*.md'
- '*/*.md'
pull_request:
branches: [main]
paths:
- docs/**
- .github/workflows/build-docs.yml
- cpp-linter/src/**
- '*.md'
- '*/*.md'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
cache-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
with:
persist-credentials: false
- run: rustup update --no-self-update
- name: Cache .cargo locked resources
uses: actions/cache@v5.0.5
with:
path: ~/.cargo
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- run: cargo fetch
seed-build-script:
runs-on: ubuntu-latest
name: Pre-seed static binaries' versions
steps:
- env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release download
-R cpp-linter/clang-tools-static-binaries
--pattern versions.json
--output versions.json
- name: Upload versions.json
uses: actions/upload-artifact@v7
with:
name: static-binary-versions
path: versions.json
if-no-files-found: error
build-mkdocs:
runs-on: ubuntu-latest
needs: [cache-deps, seed-build-script]
steps:
- uses: actions/checkout@v6.0.2
with:
persist-credentials: false
- name: Cache .cargo locked resources
uses: actions/cache/restore@v5.0.5
with:
path: ~/.cargo
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@aaa84a43aec4955a42c5ffc65d258961e39f276e # v1.19.1
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install nur
run: cargo binstall -y nur
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Restore build script seed
uses: actions/download-artifact@v8
with:
name: static-binary-versions
path: clang-tools-manager
- name: Build docs
run: nur docs --build
- name: Upload docs build as artifact
uses: actions/upload-pages-artifact@v5
with:
name: cpp-linter-docs
path: docs/site
build-rustdoc:
runs-on: ubuntu-latest
needs: [cache-deps, seed-build-script]
steps:
- uses: actions/checkout@v6.0.2
with:
persist-credentials: false
- run: rustup update --no-self-update
- name: Cache .cargo locked resources
uses: actions/cache/restore@v5.0.5
with:
path: ~/.cargo
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('Cargo.lock') }}
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@aaa84a43aec4955a42c5ffc65d258961e39f276e # v1.19.1
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Install nur
run: cargo binstall -y nur
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Restore build script seed
uses: actions/download-artifact@v8
with:
name: static-binary-versions
path: clang-tools-manager
- run: nur docs rs
- name: upload rustdoc build as artifact
uses: actions/upload-artifact@v7
with:
path: target/doc
name: cpp-linter-api_docs
deploy:
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
needs: [build-mkdocs]
runs-on: ubuntu-latest
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v5
id: deployment
with:
token: ${{ secrets.GITHUB_TOKEN }}
artifact_name: cpp-linter-docs