The web version of the latest Console newsletter.
- Production website: https://console.dev/latest
- Test environment: https://home-latest-test.consoledev.workers.dev
- Deploy action
- Interesting tools source Google Sheet
- Beta programs source Google Sheet
- Content is extracted from the source sheets by the gsheet.action GitHub Action.
- The JSON is merged into the static HTML: public/index.html
- The static HTML is deployed to Cloudflare Workers Sites using the Wranger GitHub Action.
- Install Cloudflare Wrangler for deployment and managing the static worker site.
- Set up Python virtual environment:
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt
wrangler preview --watch
wrangler publish --env test
Available at: https://home-latest-test.consoledev.workers.dev
Automatic deployment: run
workflow
and enter production
as the deployment environment.
Manual deployment (you must build the HTML before deploying):
wrangler publish --env production
The build_html.py
script is triggered as part of the deployment process. It
takes as a parameter a JSON files containing the source lists, then outputs it
as a static HTML page. The goal is to have the site serve static HTML rather
than, for example, load a JSON file on demand. This is purely for better
performance on page load times.
Uses the Python Jinja2 template engine.
An example of the expected JSON files format can in the root. This file in generated by the gsheet.action.
usage: build_html.py [-h] --tools-json TOOLS_JSON --beta-json BETA_JSON --template TEMPLATE --output OUTPUT [--ignore-date IGNORE_DATE]
optional arguments:
-h, --help show this help message and exit
--tools-json TOOLS_JSON
Path to the file containing the interesting tools list as a JSON object
--beta-json BETA_JSON
Path to the file containing the beta list as a JSON object
--template TEMPLATE Path to the file containing the table template within the templates/ directory
--output OUTPUT Path to the location of the output file (will be created if it does not exist, overwritten if it does)
--ignore-date IGNORE_DATE
Output every item in the JSON regardless of the date. Used for testing
The Google Service Account is used by gsheet.action to pull the contents of the beta programs source Google Sheet. The Google Sheets API is enabled for the Service Account.
CF_API_TOKEN
- Cloudflare API token to deploy.GSHEET_CLIENT_EMAIL
- email of the Google Service Account.GSHEET_PRIVATE_KEY
- private key of the Google Service Account. Download JSON then extract private key component.