# Deployment

Table of Contents

The project docs are deployed to the remote repo gh-pages branch using the deploy.sh bash script. The script is run locally from the main branch which will be used for the build. Local main must be up-to-date with all changes by contributors.

Link Validator validates links with or without attached anchors. It is the last line of defense to prevent invalid links in the docs prior to deployment. See Link Validation to run its Node.js script.

# Understand deploy.sh

  1. Builds a static website and places it in .vuepress/dist. The /dist folder is deleted if it exists and re-created.

    # build the docs
    npm run docs:build
    
    1
    2
  2. The deployment must be run from the .vuepress/dist folder.

    # navigate to the build output directory
    cd docs/.vuepress/dist
    
    1
    2
  3. The .vuepress/dist folder is staged to be pushed.

    # api3dao/api3-doc uses the main branch as default.
    # git init must start with a main branch so gh-pages will
    # "hang" off of it.
    git init --initial-branch=main
    git add -A
    git commit -m 'Deploying a locally built /dist folder to main:gh-pages as its own commit history.'
    
    1
    2
    3
    4
    5
    6
  4. A git push is forced onto the remote branch gh-pages.

    # If you are deploying to https://<USERNAME>.github.io/<REPO>
    # NEVER push to main, use main:gh-pages.
    git push -f git@github.com:api3dao/api3-docs.git main:gh-pages
    
    1
    2
    3

# Deploying

It is important to pull down the main branch (step 3) after the remote master repo has been merged with all contributions. This insures the local build of the /dist folder gets the latest from all contributors.

  1. Verify the repo target in deploy.sh is set to api3dao/api3-docs. It is unlikely this has changed since the script went through final testing back in Feb 2021.

    # Verify only, do not execute outside the deploy.sh script.
    git push -f git@github.com:api3dao/api3-docs.git main:gh-pages
    
    1
    2
  2. Run link-validator.js to verify hyperlinks and any anchors.

  3. Verify the proper versions are up-to-date in config.json.

    • Document set versions.
    • Document set latest version.
    • Check the Airnode startPath.
  4. Git

    • Commit and push local work to the remote repo.
    • From the remote repo, merge contributing branches to main.
    • Return to your local repo and switch to the main branch.
    • Pull remote main to local main.
  5. Deploy

    • Deploy from a desired local branch, usually main.
    • Execute deploy.sh to deploy.
    # cd <root of project>
    # Verify the branch that is set.
    % /Users/warren/DEV/api3-docs [main]
    sh deploy.sh
    
    1
    2
    3
    4
Last Updated: 8/9/2022, 2:28:25 PM