Sync with permaweb/hyperbeam
#4
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
| name: 🥘 Build & Deploy Docs HB | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| # Trigger on changes to docs, mkdocs config, or the workflow itself | |
| - "docs/**" | |
| - "mkdocs.yml" | |
| - ".github/workflows/build-deploy-docs.yml" | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| # Trigger on changes to docs, mkdocs config, or the workflow itself | |
| - "docs/**" | |
| - "mkdocs.yml" | |
| - ".github/workflows/build-deploy-docs.yml" | |
| # Perform a release using a workflow dispatch | |
| workflow_dispatch: | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| # Run the build as part of PRs to confirm the site properly builds | |
| check_build: | |
| if: ${{ startsWith(github.ref, 'refs/pull/') }} | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: ⬇️ Checkout repo | |
| uses: actions/checkout@v3 | |
| # Setup Python environment | |
| - name: 🐍 Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' # Use a recent Python 3 version | |
| # Install Erlang OTP 27 using kerl | |
| - name: Install Erlang OTP 27 | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential autoconf libncurses5-dev libssl-dev | |
| git clone https://github.com/kerl/kerl.git | |
| ./kerl/kerl build 27.0 otp-27.0 | |
| ./kerl/kerl install otp-27.0 ~/otp-27.0 | |
| echo '. ~/otp-27.0/activate' >> ~/.bashrc | |
| . ~/otp-27.0/activate | |
| echo "Erlang version:" | |
| erl -eval 'io:format("~s~n", [erlang:system_info(otp_release)]), halt().' | |
| # Install system dependencies needed for HyperBEAM | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| cmake \ | |
| pkg-config \ | |
| ncurses-dev \ | |
| libssl-dev \ | |
| ca-certificates | |
| # Debug step - display the region with syntax error | |
| - name: Debug syntax error region | |
| run: | | |
| echo "Showing the region with syntax error in hb_message.erl:" | |
| sed -n '1440,1460p' src/hb_message.erl || echo "File not found or cannot be read" | |
| echo "Checking for syntax error fix files:" | |
| find . -name "*.erl.fix" -o -name "hb_message.erl.*" | grep -v ".beam" || echo "No fix files found" | |
| echo "Erlang version:" | |
| . ~/otp-27.0/activate && erl -eval 'io:format("~s~n", [erlang:system_info(otp_release)]), halt().' | |
| # Install rebar3 | |
| - name: Install rebar3 | |
| run: | | |
| . ~/otp-27.0/activate | |
| mkdir -p ~/.config/rebar3 | |
| curl -O https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3 | |
| sudo mv rebar3 /usr/local/bin/rebar3 | |
| . ~/otp-27.0/activate && rebar3 --version | |
| # Install Rust toolchain (needed for WASM components) | |
| - name: Install Rust and Cargo | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| source "$HOME/.cargo/env" | |
| # Setup Node.js | |
| - name: ⎔ Setup Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 22 # Or your preferred version | |
| # Install pip dependencies and cache them | |
| - name: 📦 Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install mkdocs mkdocs-material mkdocs-git-revision-date-localized-plugin | |
| - name: 🛠 Build Docs | |
| run: | | |
| . ~/otp-27.0/activate | |
| SKIP_COMPILE=1 SKIP_EDOC=1 ./docs/build-all.sh -v | |
| # Build and deploy the artifacts to Arweave via ArDrive | |
| deploy: | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-22.04 | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these deployments to complete. | |
| concurrency: | |
| group: deploy | |
| cancel-in-progress: false | |
| steps: | |
| - name: ⬇️ Checkout repo | |
| uses: actions/checkout@v3 | |
| # Setup Python environment | |
| - name: 🐍 Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| # Install Erlang OTP 27 using kerl | |
| - name: Install Erlang OTP 27 | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential autoconf libncurses5-dev libssl-dev | |
| git clone https://github.com/kerl/kerl.git | |
| ./kerl/kerl build 27.0 otp-27.0 | |
| ./kerl/kerl install otp-27.0 ~/otp-27.0 | |
| echo '. ~/otp-27.0/activate' >> ~/.bashrc | |
| . ~/otp-27.0/activate | |
| echo "Erlang version:" | |
| erl -eval 'io:format("~s~n", [erlang:system_info(otp_release)]), halt().' | |
| # Install system dependencies needed for HyperBEAM | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| cmake \ | |
| pkg-config \ | |
| ncurses-dev \ | |
| libssl-dev \ | |
| ca-certificates | |
| # Debug step - display the region with syntax error | |
| - name: Debug syntax error region | |
| run: | | |
| echo "Showing the region with syntax error in hb_message.erl:" | |
| sed -n '1440,1460p' src/hb_message.erl || echo "File not found or cannot be read" | |
| echo "Checking for syntax error fix files:" | |
| find . -name "*.erl.fix" -o -name "hb_message.erl.*" | grep -v ".beam" || echo "No fix files found" | |
| echo "Erlang version:" | |
| . ~/otp-27.0/activate && erl -eval 'io:format("~s~n", [erlang:system_info(otp_release)]), halt().' | |
| # Install rebar3 | |
| - name: Install rebar3 | |
| run: | | |
| . ~/otp-27.0/activate | |
| mkdir -p ~/.config/rebar3 | |
| curl -O https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3 | |
| sudo mv rebar3 /usr/local/bin/rebar3 | |
| . ~/otp-27.0/activate && rebar3 --version | |
| # Install Rust toolchain (needed for WASM components) | |
| - name: Install Rust and Cargo | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| source "$HOME/.cargo/env" | |
| # Install pip dependencies and cache them | |
| - name: 📦 Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install mkdocs mkdocs-material mkdocs-git-revision-date-localized-plugin | |
| # Setup Node.js (needed for npx deploy command) | |
| - name: ⎔ Setup Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 22 # Or your preferred version | |
| - name: 👀 Env | |
| run: | | |
| echo "Event name: ${{ github.event_name }}" | |
| echo "Git ref: ${{ github.ref }}" | |
| echo "GH actor: ${{ github.actor }}" | |
| echo "SHA: ${{ github.sha }}" | |
| VER=`node --version`; echo "Node ver: $VER" | |
| VER=`npm --version`; echo "npm ver: $VER" | |
| . ~/otp-27.0/activate && erl -eval 'io:format("Erlang OTP version: ~s~n", [erlang:system_info(otp_release)]), halt().' | |
| - name: 🛠 Build Docs | |
| id: build_artifacts | |
| run: | | |
| . ~/otp-27.0/activate | |
| SKIP_COMPILE=1 SKIP_EDOC=1 ./docs/build-all.sh -v | |
| touch mkdocs-site/.nojekyll | |
| echo "artifacts_output_dir=mkdocs-site" >> $GITHUB_OUTPUT | |
| - name: 💾 Publish to Arweave | |
| id: publish_artifacts | |
| run: | | |
| npx permaweb-deploy \ | |
| --arns-name=dps-testing-facility \ | |
| --ant-process=${{ secrets.ANT_PROCESS }} \ | |
| --deploy-folder=${ARTIFACTS_OUTPUT_DIR} | |
| env: | |
| DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} | |
| ARTIFACTS_OUTPUT_DIR: ${{ steps.build_artifacts.outputs.artifacts_output_dir }} | |
| ANT_PROCESS: ${{ secrets.ANT_PROCESS }} |