-
Notifications
You must be signed in to change notification settings - Fork 106
139 lines (121 loc) · 4.43 KB
/
publish-docs.yaml
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#
# Copyright 2023 Winford (Uncle Grumpy) <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
# This is a workflow for atomvm/AtomVM to Publish API documentation and other content from the `doc` directory to
# atomvm.net hosted on GitHub Pages
name: Publish Docs
# Controls when the workflow will run
on:
# Triggers the workflow on pull request, tag events and pushes on main
push:
tags:
- '**'
branches:
- 'main'
- 'release-**'
paths:
- '.github/workflows/publish-docs.yaml'
- 'CMakeLists.txt'
- 'doc/**'
- 'libs/**'
- 'src/libAtomVM/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
AVM_DOCS_NAME: ${{ github.ref_name }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Install Deps
run: |
sudo apt update -y
DEBIAN_FRONTEND=noninteractive sudo apt install -y git cmake doxygen graphviz python3-pip python3-virtualenv python3-setuptools python3-stemmer wget
- uses: actions/cache@v4
id: sphinx-cache
with:
path: /home/runner/python-env/sphinx
key: ${{ runner.os }}-sphinx-install
- name: Install Sphinx
if: ${{ steps.sphinx-cache.outputs.cache-hit != 'true' }}
run: |
python3 -m venv /home/runner/python-env/sphinx
. /home/runner/python-env/sphinx/bin/activate
python3 -m pip install sphinx
python3 -m pip install myst-parser
python3 -m pip install sphinx-rtd-theme
python3 -m pip install rinohtype
python3 -m pip install pillow
python3 -m pip install gitpython
python3 -m pip install breathe
python3 -m pip install pygments
- uses: erlef/setup-beam@v1
with:
otp-version: "27"
elixir-version: "1.17"
hexpm-mirrors: |
https://builds.hex.pm
https://repo.hex.pm
https://cdn.jsdelivr.net/hex
- name: Install rebar3
working-directory: /tmp
run: |
wget https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3
./rebar3 local install
echo "/home/runner/.cache/rebar3/bin" >> ${GITHUB_PATH}
- uses: actions/checkout@v4
with:
repository: ${{ vars.GITHUB_REPOSITORY }}
fetch-depth: 0
- uses: actions/checkout@v4
id: checkout-production
with:
repository: atomvm/atomvm_www
ref: Production
path: /home/runner/work/AtomVM/AtomVM/www
- name: Track all branches
shell: bash
run: |
git config --global --add safe.directory /__w/AtomVM/AtomVM
for branch in `git branch -a | grep "remotes/origin" | grep -v HEAD | grep -v "${{ github.ref_name }}" `; do
git branch --track ${branch#remotes/origin/} $branch
done
- name: Build Site
shell: bash
run: |
. /home/runner/python-env/sphinx/bin/activate
mkdir build
cd build
cmake ..
cd doc
make GitHub_CI_Publish_Docs
- name: Commit files
if: github.repository == 'atomvm/AtomVM'
working-directory: /home/runner/work/AtomVM/AtomVM/www
run: |
git checkout Production
git config --local user.email "[email protected]"
git config --local user.name "AtomVM Doc Bot"
git add .
git commit -m "Update Documentation"
- name: Push changes
if: github.repository == 'atomvm/AtomVM'
working-directory: /home/runner/work/AtomVM/AtomVM/www
run: |
eval `ssh-agent -t 60 -s`
echo "${{ secrets.PUBLISH_ACTION_KEY }}" | ssh-add -
mkdir -p ~/.ssh/
ssh-keyscan github.com >> ~/.ssh/known_hosts
git remote add push_dest "[email protected]:atomvm/atomvm_www.git"
git fetch push_dest
git push --set-upstream push_dest Production