Skip to content

tooling: Auto-sync driver examples to micropython-steami-sample on release. #408

@nedseb

Description

@nedseb

What

Add an automatic sync job that copies all driver examples from lib/*/examples/*.py into a drivers/ directory in steamicc/micropython-steami-sample after each release.

Why

Driver examples live in this repo (close to the code they validate) but students look for examples in micropython-steami-sample. Currently there is no link between the two repos — the 94 example files across 15 drivers are invisible to students unless they browse this repo directly.

How

1. Create scripts/sync_examples.sh

A simple shell script that:

  • Takes a version string and a target directory as arguments
  • Deletes <target>/drivers/ and recreates it from lib/*/examples/*.py
  • Generates a drivers/README.md with the version and a "do not edit" notice

2. Add a sync-examples job to .github/workflows/release.yml

After semantic-release publishes a new version:

  1. Checkout this repo at the release tag
  2. Checkout micropython-steami-sample
  3. Run scripts/sync_examples.sh
  4. Commit and push to micropython-steami-sample

Uses the same GitHub App token already configured for semantic-release.

3. Update CONTRIBUTING.md

Short mention of the sync mechanism so contributors know their examples will propagate to the sample repo.

Blocked by

Verification

Run scripts/sync_examples.sh v0.23.1 /tmp/sample-test locally and verify the drivers/ directory contains all expected files.

Metadata

Metadata

Labels

toolingDeveloper tooling, build system, hooks

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions