Skip to content

Commit b0f2085

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 b0f2085

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/publish_docs.yml

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

0 commit comments

Comments
 (0)