nim-chronos/.github/workflows/doc.yml

63 lines
1.6 KiB
YAML

name: Docgen
on:
push:
branches:
- master
- docs
workflow_dispatch:
jobs:
build:
timeout-minutes: 20
name: 'Generate & upload documentation'
runs-on: 'ubuntu-latest'
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- uses: jiro4989/setup-nim-action@v1
with:
nim-version: '1.6.16'
- name: Generate doc
run: |
nim --version
nimble --version
nimble install -dy
# nim doc can "fail", but the doc is still generated
nim doc --git.url:https://github.com/status-im/nim-chronos --git.commit:master --outdir:docs --project chronos || true
# check that the folder exists
ls docs
- name: Clone the gh-pages branch
uses: actions/checkout@v3
with:
repository: status-im/nim-chronos
ref: gh-pages
path: subdoc
submodules: true
fetch-depth: 0
- name: Commit & push
run: |
cd subdoc
# Update / create this branch doc
rm -rf docs
mv ../docs .
# Remove .idx files
# NOTE: git also uses idx files in his
# internal folder, hence the `*` instead of `.`
find * -name "*.idx" -delete
git add .
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name = "${{ github.actor }}"
git commit -a -m "update docs"
git push origin gh-pages