Skip to content

Commit 7d44588

Browse files
committed
Add workflow automation to publish docs
Automates the publication of documentation to github pages when changes are merged to the master branch. This will keep the github pages in sync with the master barnch and users can use the docs published to hex.pm for release versions. Signed-off-by: Winford <[email protected]>
1 parent eadd0f4 commit 7d44588

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/publish_docs.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#
2+
# Copyright 2025 Winford (Uncle Grumpy) <[email protected]>
3+
#
4+
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
5+
#
6+
# This is a workflow for atomvm/atomvm_packbeam to publish documentation to GitHub Pages
7+
8+
name: Publish Docs
9+
10+
on:
11+
# Triggers the workflow on tags
12+
push:
13+
branches:
14+
- 'master'
15+
16+
# Allows you to run this workflow manually from the Actions tab
17+
workflow_dispatch:
18+
19+
jobs:
20+
publish:
21+
runs-on: ubuntu-24.04
22+
permissions:
23+
contents: read
24+
pull-requests: write
25+
26+
steps:
27+
- name: "Install deps"
28+
run: |
29+
sudo apt install -y make git
30+
31+
- uses: actions/checkout@v4
32+
with:
33+
repository: ${{ vars.GITHUB_REPOSITORY }}
34+
fetch-depth: 0
35+
36+
- uses: erlef/setup-beam@5304e04ea2b355f03681464e683d92e3b2f18451
37+
with:
38+
otp-version: "27"
39+
40+
- name: "Build rebar3"
41+
run: |
42+
cd /tmp
43+
git clone https://github.com/erlang/rebar3.git
44+
cd rebar3
45+
./bootstrap
46+
47+
- name: "Build Docs"
48+
run: |
49+
git checkout -b updates
50+
PATH="/tmp/rebar3:${PATH}" make doc
51+
52+
- name: Commit files
53+
if: github.repository == 'atomvm/atomvm_packbeam'
54+
run: |
55+
git branch --show-current
56+
git status
57+
git config --local user.email "[email protected]"
58+
git config --local user.name "AtomVM Doc Bot"
59+
git status
60+
git add .
61+
git commit -m "Update Documentation ${{ github.ref_name }}"
62+
63+
- name: Push changes
64+
if: github.repository == 'atomvm/atomvm_packbeam'
65+
run: |
66+
eval `ssh-agent -t 60 -s`
67+
echo "${{ secrets.PUBLISH_KEY }}" | ssh-add -
68+
mkdir -p ~/.ssh/
69+
ssh-keyscan github.com >> ~/.ssh/known_hosts
70+
git remote add live_pages "[email protected]:atomvm/atomvm_packbeam.git"
71+
git fetch live_pages
72+
git diff --quiet live_pages/gh-pages || echo "Pushing updated documentation"
73+
git diff --quiet live_pages/gh-pages || git push --set-upstream live_pages updates:gh-pages -f

0 commit comments

Comments
 (0)