Skip to content

Commit ce3ef44

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 ce3ef44

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

.github/workflows/publish_docs.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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+
build:
21+
runs-on: ubuntu-24.04
22+
permissions:
23+
contents: read
24+
25+
steps:
26+
- name: "Install deps"
27+
run: |
28+
sudo apt install -y make git
29+
30+
- uses: erlef/setup-beam@v1
31+
with:
32+
otp-version: "28"
33+
34+
- name: "Build rebar3"
35+
run: |
36+
cd /tmp
37+
git clone https://github.com/erlang/rebar3.git
38+
cd rebar3
39+
./bootstrap
40+
41+
- name: "Checkout code"
42+
uses: actions/checkout@v4
43+
with:
44+
repository: ${{ vars.GITHUB_REPOSITORY }}
45+
fetch-depth: 0
46+
47+
- name: "Setup Pages"
48+
uses: actions/configure-pages@v5
49+
50+
- name: "Build Docs"
51+
run: |
52+
PATH="/tmp/rebar3:${PATH}" make doc
53+
54+
- name: Upload docs artifact
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: github-pages
58+
path: ./docs
59+
if-no-files-found: error
60+
61+
deploy:
62+
# Add a dependency to the build job
63+
needs: build
64+
65+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
66+
permissions:
67+
pages: write # to deploy to Pages
68+
id-token: write # to verify the deployment originates from an appropriate source
69+
70+
# Deploy to the github-pages environment
71+
environment:
72+
name: github-pages
73+
url: ${{ steps.deployment.outputs.page_url }}
74+
75+
# Specify runner + deployment step
76+
runs-on: ubuntu-latest
77+
steps:
78+
- name: Deploy to GitHub Pages
79+
if: ${{ github.repository == 'atomvm/atomvm_packbeam' }}
80+
id: deployment
81+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)