Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.
/ home-latest Public archive

The (autogenerated) web version of the latest Console newsletter. Archived: Moved into the home repo.

Notifications You must be signed in to change notification settings

consoledotdev/home-latest

Repository files navigation

Latest Console newsletter - web version

The web version of the latest Console newsletter.

Links

Build process

  1. Content is extracted from the source sheets by the gsheet.action GitHub Action.
  2. The JSON is merged into the static HTML: public/index.html
  3. The static HTML is deployed to Cloudflare Workers Sites using the Wranger GitHub Action.

Setup

  1. Install Cloudflare Wrangler for deployment and managing the static worker site.
  2. Set up Python virtual environment:
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt

Site deployment

Local dev

wrangler preview --watch

Live testing

wrangler publish --env test

Available at: https://home-latest-test.consoledev.workers.dev

Production

Automatic deployment: run workflow and enter production as the deployment environment.

Manual deployment (you must build the HTML before deploying):

wrangler publish --env production

Build HTML

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

Authentication

Google Service Account

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.

Secrets

  • 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.

About

The (autogenerated) web version of the latest Console newsletter. Archived: Moved into the home repo.

Topics

Resources

Stars

Watchers

Forks