Skip to content

Commit 173cc67

Browse files
committed
Add workflow automation to publish docs on new tags
Automates the publication of documentation to github pages. Signed-off-by: Winford <[email protected]>
1 parent 2daea6d commit 173cc67

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

.github/workflows/build-and-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
with:
2323
submodules: 'recursive'
2424

25-
- uses: erlef/setup-beam@v1
25+
- uses: erlef/setup-beam@5304e04ea2b355f03681464e683d92e3b2f18451
2626
with:
2727
otp-version: ${{ matrix.otp }}
2828

.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_www to Publish atomvm.net documentation using GitHub Pages
7+
8+
name: Publish Docs
9+
10+
on:
11+
# Triggers the workflow on tags
12+
push:
13+
tags:
14+
- '**'
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 "Going to push"
73+
git diff --quiet live_pages/gh-pages || git push --set-upstream live_pages updates:gh-pages -f

0 commit comments

Comments
 (0)