summaryrefslogtreecommitdiff
path: root/.github/workflows/docs.yml
blob: 11eac70fcad78ae6742e6d9dbe416006fee9834a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Upload documentation

on:
  push:
    branches:
      - master

jobs:
  upload_docs:
    name: Upload documentation
    runs-on: ubuntu-22.04
    if: github.repository == 'rust-lang/libc'

    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Setup Rust toolchain
        run: TARGET=x86_64-unknown-linux-gnu sh ./ci/install-rust.sh
      - name: Generate documentation
        run: LIBC_CI=1 sh ci/dox.sh
      - name: Deploy GitHub Pages
        run: |
          git worktree add gh-pages gh-pages
          git config user.name "Deploy from CI"
          git config user.email ""
          cd gh-pages
          # Delete the ref to avoid keeping history.
          git update-ref -d refs/heads/gh-pages
          rm -rf *
          mv ../target/doc/* .
          git add .
          git commit -m "Deploy $GITHUB_SHA to gh-pages"
          git push --force