Bash and Javascript scripts to generate the static site for the Digital Public Goods from a WordPress site. The scripts on this repo are not meant to be used directly, but rather used in the creation of automatic builds through a Continuous Integration (CI) framework, such as a GitHub Pages.
This is one of four interconnected repositories; refer to the publicgoods-website for an overview.
This repository is managed with NPM version 7 workspaces which requires Node version 15 or higher. Read the workspaces documentation to know how to install and manage dependencies across packages in this repository.
To test the functionality of these scripts, you can run the following commands in sequence:
npm i
: Installs all the required project dependencies- Clone the other interconnected repositories:
git clone https://github.com/DPGAlliance/publicgoods-website.git ../publicgoods-website git clone https://github.com/DPGAlliance/publicgoods-candidates.git ../publicgoods-candidates
./scripts/static.bash
: crawls a private instance of the WordPress website and saves a copy in../publicgoods-website
pushd packages/automation && node consolidate_data.js && popd
: consolidates nomiees and DPGs from the new api into a singlenominees.json
file for the registry page.pushd packages/automation && node generate_dpgs.js && popd
: generates the individual website pages for each vetted digital public goodpushd packages/automation && node generate_nominees.js && popd
: queries the GitHub API for activity data for each linked repopushd packages/automation && node index.js && popd
: generates the registry pagepushd packages/registry && npm run build && popd
: builds the React components associated with the registry./scripts/moveFiles.bash
: moves the React components generated above and the registry page into the website folder
To test the result:
- Change folders into the website repo:
cd ../publicgoods-website
- Run a webserver:
./.develop.bash
- Point your browser to http://localhost:8080 to see the result
When a merge is pushed onto the main
branch in the DPGAlliance/publicgood-scripts repository, no build is pushed to the DPGA public website.
The public website is updated under these 3 circumstances:
- When a commit or pull request is merged on the
main
branch of the DPGAlliance/publicgood-candidates repo - Every night at midnight GMT
- Manually triggered through GitHub Actions in the DPGAlliance/publicgood-candidates repo
You can manually trigger a new website build by visiting the Actions tab on the publicgoods-candidates repo, though you need Write permissions on that repo:
- Visit the Actions link
- Click on Automatic Build on the left column.
- Click on Run Workflow on the right side, (keep the main branch selected) and click again the green Run Workflow button.
Wait for about 10 minutes, and the new website will reflect the changes from the DPGAlliance/publicgood-scripts repository.