Skip to content

Commit 50f7503

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 50f7503

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

.github/workflows/publish_docs.yml

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

0 commit comments

Comments
 (0)