aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/docgen.yml
blob: 0415ed533266a049b4fd522700ff91d24314e3bf (plain) (blame)
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
name: docgen

on:
  push:
    branches:
      - master

jobs:
  docgen:
    runs-on: [ubuntu-latest]
    permissions:
      contents: write
    steps:
    - uses: actions/checkout@v2
    - uses: rhysd/action-setup-vim@v1
      with:
        neovim: true
        version: nightly
    - name: Run docgen
      run: |
        scripts/docgen.sh
    - name: Commit changes
      env:
        COMMIT_MSG: |
          docs: update CONFIG.md
          skip-checks: true
      run: |
        git config user.name github-actions
        git config user.email github-actions@github.com
        git add CONFIG.md
        # Only commit and push if we have changes
        git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push)
  vimdocgen:
    needs: docgen
    runs-on: [ubuntu-latest]
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v2
      - uses: rhysd/action-setup-vim@v1
        with:
          neovim: true
          version: nightly
      - name: Install plugins
        run: |
          mkdir -p ~/.local/share/nvim/site/pack/vendor/start
          git clone --depth 1 https://github.com/mjlbach/babelfish.nvim ~/.local/share/nvim/site/pack/vendor/start/babelfish.nvim
          git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter ~/.local/share/nvim/site/pack/vendor/start/nvim-treesitter
          ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start

      - name: Build parser
        run: |
          export PACKPATH=$HOME/.local/share/nvim/site
          nvim -u ~/.local/share/nvim/site/pack/vendor/start/babelfish.nvim/scripts/init.lua --headless -c 'TSInstallSync markdown' -c 'qa'
      - name: Generating docs
        run: |
          export PATH="${PWD}/build/:${PATH}"
          export PACKPATH=$HOME/.local/share/nvim/site
          nvim -u ~/.local/share/nvim/site/pack/vendor/start/babelfish.nvim/scripts/init.lua --headless -c 'luafile ./scripts/vimdocgen.lua' -c 'qa'
      - name: Commit changes
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          COMMIT_MSG: |
            docs: update README.md
            skip-checks: true
        run: |
          git config user.email "actions@github"
          git config user.name "Github Actions"
          git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
          git pull
          git add doc/lspconfig.txt
          # Only commit and push if we have changes
          git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin HEAD:${GITHUB_REF})