CI #1518
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
repository_dispatch: | |
types: docs | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Site | |
uses: actions/checkout@v3 | |
- run: | | |
git fetch --prune --unshallow | |
- name: Checkout NuttX repo | |
uses: actions/checkout@v3 | |
with: | |
repository: apache/nuttx | |
fetch-depth: 0 | |
ref: master | |
path: nuttx | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.8' | |
- name: Build docs | |
run: | | |
pip3 install pipenv | |
cd nuttx/Documentation | |
# For now install only dependencies from master for all versions | |
# of documentation so far old versions can use these updated pin | |
# but the old pins in old releases cannot always be used. | |
pipenv install | |
DOCDIR=../../docs | |
rm -rf $DOCDIR | |
NUTTX_TAGS=$(git tag -l 'nuttx-1?.*' | fgrep -v RC) | |
export NUTTX_VERSIONS=$(echo -n "$NUTTX_TAGS" | sed -r 's|^nuttx-||g' | tr '\n' ',') | |
echo "Building documentation for nuttx: $NUTTX_VERSIONS (and master)" | |
for nuttx_version in $NUTTX_TAGS master; do | |
git checkout -f $nuttx_version | |
if [ "$nuttx_version" = "master" ]; then | |
OUTDIR="$DOCDIR/latest" | |
else | |
OUTDIR="$DOCDIR/${nuttx_version#nuttx-}" | |
fi | |
pipenv run make html BUILDDIR="$OUTDIR" | |
mv $OUTDIR/html/* $OUTDIR | |
rm -rf $OUTDIR/{html,doctrees} | |
done | |
cd ../.. | |
- name: Install Ruby tools | |
run: | | |
sudo apt-get -y install rubygems ruby-dev zlib1g-dev | |
- name: Build Site | |
run: | | |
export GEM_HOME=$HOME/.gem | |
export PATH=$PATH:$GEM_HOME/bin | |
username="`git log -1 --pretty=format:'%an'`" | |
email="`git log -1 --pretty=format:'%ae'`" | |
git config --global user.name "$username" | |
git config --global user.email "$email" | |
./publish.sh | |
- name: Upload artifact of staged site | |
uses: actions/upload-artifact@v3 | |
with: | |
name: static-site | |
path: content | |
- name: Publish Site | |
if: (github.event_name == 'push' || github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) && github.ref == 'refs/heads/master' | |
run: | | |
git push origin asf-site:asf-site |