Add workflow automation to publish docs #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | ||
| # Copyright 2025 Winford (Uncle Grumpy) <[email protected]> | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later | ||
| # | ||
| # This is a workflow for atomvm/atomvm_packbeam to publish documentation to GitHub Pages | ||
| name: Publish Docs | ||
| on: | ||
| # Triggers the workflow on tags | ||
| push: | ||
| branches: | ||
| - 'master' | ||
| # Allows you to run this workflow manually from the Actions tab | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: read | ||
| # Grant GITHUB_TOKEN the permissions required to make a Pages deployment | ||
| pages: write # to deploy to Pages | ||
| id-token: write # to verify the deployment originates from an appropriate source | ||
| # Deploy to the github-pages environment | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| steps: | ||
| - name: "Install deps" | ||
| run: | | ||
| sudo apt install -y make git | ||
| - uses: erlef/setup-beam@v1 | ||
| with: | ||
| otp-version: "28" | ||
| - name: "Build rebar3" | ||
| run: | | ||
| cd /tmp | ||
| git clone https://github.com/erlang/rebar3.git | ||
| cd rebar3 | ||
| ./bootstrap | ||
| - name: "Checkout code" | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: ${{ vars.GITHUB_REPOSITORY }} | ||
| fetch-depth: 0 | ||
| - name: "Setup Pages" | ||
| uses: actions/configure-pages@v5 | ||
| - name: "Build Docs" | ||
| if: github.repository == 'atomvm/atomvm_packbeam' | ||
| run: | | ||
| PATH="/tmp/rebar3:${PATH}" make doc | ||
| - name: Upload docs artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: atomvm_packbeam-docs | ||
| path: ./docs | ||
| if-no-files-found: error | ||
| deploy: | ||
| # Add a dependency to the build job | ||
| needs: build | ||
| # Grant GITHUB_TOKEN the permissions required to make a Pages deployment | ||
| permissions: | ||
| pages: write # to deploy to Pages | ||
| id-token: write # to verify the deployment originates from an appropriate source | ||
| # Deploy to the github-pages environment | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| # Specify runner + deployment step | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| if: ${{ github.repository == 'atomvm/atomvm_packbeam' }} | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||