fix(CI): rebuild website job (#1125)

This commit is contained in:
diegomrsantos 2024-06-19 16:40:01 +02:00 committed by GitHub
parent fba6dc31b0
commit 0be7144e34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 10 deletions

View File

@ -1,6 +1,8 @@
name: Docgen name: Docgen
on: on:
push: push:
branches:
- master
workflow_dispatch: workflow_dispatch:
@ -27,7 +29,7 @@ jobs:
nimble --version nimble --version
nimble install_pinned nimble install_pinned
# nim doc can "fail", but the doc is still generated # 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 nim doc --git.url:https://github.com/vacp2p/nim-libp2p --git.commit:${GITHUB_REF##*/} --outdir:${GITHUB_REF##*/} --project libp2p || true
# check that the folder exists # check that the folder exists
ls ${GITHUB_REF##*/} ls ${GITHUB_REF##*/}
@ -35,7 +37,7 @@ jobs:
- name: Clone the gh-pages branch - name: Clone the gh-pages branch
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
repository: status-im/nim-libp2p repository: vacp2p/nim-libp2p
ref: gh-pages ref: gh-pages
path: subdoc path: subdoc
submodules: true submodules: true
@ -45,9 +47,6 @@ jobs:
run: | run: |
cd subdoc 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 # Update / create this branch doc
rm -rf ${GITHUB_REF##*/} rm -rf ${GITHUB_REF##*/}
mv ../${GITHUB_REF##*/} . mv ../${GITHUB_REF##*/} .
@ -63,7 +62,6 @@ jobs:
git push origin gh-pages git push origin gh-pages
update_site: update_site:
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/docs'
name: 'Rebuild website' name: 'Rebuild website'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -93,11 +91,21 @@ jobs:
run: | run: |
cd subdoc cd subdoc
# Ensure the latest changes are fetched and reset to the remote branch
git fetch origin gh-pages
git reset --hard origin/gh-pages
rm -rf docs rm -rf docs
mv ../site docs mv ../site docs
git add . git add .
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name = "${{ github.actor }}" if git diff-index --quiet HEAD --; then
git commit -a -m "update website" echo "No changes to commit"
git push origin gh-pages else
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
git commit -m "update website"
git push origin gh-pages
fi