2022-07-01 18:19:57 +00:00
|
|
|
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:
|
2023-11-16 14:58:05 +00:00
|
|
|
nim-version: '1.6.x'
|
2022-07-01 18:19:57 +00:00
|
|
|
|
|
|
|
- name: Generate doc
|
|
|
|
run: |
|
|
|
|
nim --version
|
|
|
|
nimble --version
|
2023-11-16 14:58:05 +00:00
|
|
|
nimble install_pinned
|
2022-07-01 18:19:57 +00:00
|
|
|
# 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
|
2022-07-26 10:44:26 +00:00
|
|
|
|
|
|
|
update_site:
|
2022-09-28 08:40:53 +00:00
|
|
|
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/docs'
|
2022-07-26 10:44:26 +00:00
|
|
|
name: 'Rebuild website'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3.x
|
|
|
|
|
2022-09-28 08:40:53 +00:00
|
|
|
- uses: jiro4989/setup-nim-action@v1
|
|
|
|
with:
|
|
|
|
nim-version: 'stable'
|
|
|
|
|
2022-07-26 10:44:26 +00:00
|
|
|
- name: Generate website
|
2022-09-28 08:40:53 +00:00
|
|
|
run: pip install mkdocs-material && nimble website
|
2022-07-26 10:44:26 +00:00
|
|
|
|
|
|
|
- name: Clone the gh-pages branch
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: status-im/nim-libp2p
|
|
|
|
ref: gh-pages
|
|
|
|
path: subdoc
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Commit & push
|
|
|
|
run: |
|
|
|
|
cd subdoc
|
|
|
|
|
|
|
|
rm -rf docs
|
|
|
|
mv ../site docs
|
|
|
|
|
|
|
|
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 website"
|
|
|
|
git push origin gh-pages
|