-
Notifications
You must be signed in to change notification settings - Fork 23
90 lines (75 loc) · 2.45 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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