mirror of https://github.com/vacp2p/nim-libp2p.git
64 lines
1.8 KiB
YAML
64 lines
1.8 KiB
YAML
|
name: Docgen
|
||
|
on:
|
||
|
push:
|
||
|
workflow_dispatch:
|
||
|
|
||
|
|
||
|
jobs:
|
||
|
build:
|
||
|
timeout-minutes: 20
|
||
|
|
||
|
name: 'Generate & upload documentation'
|
||
|
runs-on: 'ubuntu-20.04'
|
||
|
continue-on-error: true
|
||
|
steps:
|
||
|
- name: Checkout
|
||
|
uses: actions/checkout@v2
|
||
|
with:
|
||
|
submodules: true
|
||
|
|
||
|
- uses: jiro4989/setup-nim-action@v1
|
||
|
with:
|
||
|
nim-version: 'stable'
|
||
|
|
||
|
- name: Generate doc
|
||
|
run: |
|
||
|
nim --version
|
||
|
nimble --version
|
||
|
nimble install_pinned
|
||
|
# nim doc can "fail", but the doc is still generated
|
||
|
nim doc --git.url:https://github.com/status-im/nim-libp2p --git.commit:${GITHUB_REF##*/} --outdir:${GITHUB_REF##*/} --project libp2p || true
|
||
|
|
||
|
# check that the folder exists
|
||
|
ls ${GITHUB_REF##*/}
|
||
|
|
||
|
- name: Clone the gh-pages branch
|
||
|
uses: actions/checkout@v2
|
||
|
with:
|
||
|
repository: status-im/nim-libp2p
|
||
|
ref: gh-pages
|
||
|
path: subdoc
|
||
|
submodules: true
|
||
|
fetch-depth: 0
|
||
|
|
||
|
- name: Commit & push
|
||
|
run: |
|
||
|
cd subdoc
|
||
|
|
||
|
# Delete merged branches doc's
|
||
|
for branch in $(git branch -vv | grep ': gone]' | awk '{print $1}'); do rm -rf $branch; done
|
||
|
|
||
|
# Update / create this branch doc
|
||
|
rm -rf ${GITHUB_REF##*/}
|
||
|
mv ../${GITHUB_REF##*/} .
|
||
|
|
||
|
# 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 for ${GITHUB_REF##*/}"
|
||
|
git push origin gh-pages
|