File: documentation.yml

package info (click to toggle)
libgit2 1.9.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 60,816 kB
  • sloc: ansic: 203,740; javascript: 2,458; sh: 1,763; python: 384; perl: 99; php: 65; makefile: 33
file content (76 lines) | stat: -rw-r--r-- 2,011 bytes parent folder | download | duplicates (3)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Update the www.libgit2.org reference documentation
name: Generate Documentation

on:
  push:
    branches: [ main ]
  release:
  workflow_dispatch:
    inputs:
      force:
        description: 'Force rebuild'
        type: boolean
        required: true

concurrency:
  group: documentation

permissions:
  contents: read

jobs:
  documentation:
    name: "Generate documentation"
    runs-on: "ubuntu-latest"
    steps:
    - name: Check out source repository
      uses: actions/checkout@v4
      with:
        path: source
        fetch-depth: 0
    - name: Check out documentation repository
      uses: actions/checkout@v4
      with:
        repository: libgit2/www.libgit2.org
        path: www
        fetch-depth: 0
        ssh-key: ${{ secrets.DOCS_PUBLISH_KEY }}
    - name: Prepare branches
      run: |
        for a in main $(git branch -r --list 'origin/maint/*' | sed -e "s/^  origin\///"); do
          if [ "$(git rev-parse --abbrev-ref HEAD)" != "${a}" ]; then
            git branch --track "$a" "origin/$a"
          fi
        done
      working-directory: source
    - name: Generate documentation
      run: |
        args=""

        if [ "${{ inputs.force }}" = "true" ]; then
          args="--force"
        fi

        npm install
        ./generate --verbose $args ../.. ../../../www/docs
      working-directory: source/script/api-docs
    - name: Examine changes
      run: |
        if [ -n "$(git diff --name-only)" ]; then
           echo "changes=true" >> $GITHUB_OUTPUT
        else
           echo "changes=false" >> $GITHUB_OUTPUT
        fi
      id: check
      working-directory: www
    - name: Publish documentation
      run: |
        DATE=$(date +"%Y-%m-%d")

        git config user.name 'Documentation Site Generator'
        git config user.email 'libgit2@users.noreply.github.com'
        git add .
        git commit -m"Documentation update ${DATE}"
        git push origin main
      if: steps.check.outputs.changes == 'true'
      working-directory: www