Skip to content

Latest commit

 

History

History

rpi-imager-json

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Generate rpi-imager.json from released snippet assets

Generates an rpi-imager.json based on latest GitHub stable and prereleases, utilizing attached rpi-imager.json snippets as e.g. generated by OctoPi-UpToDate's CustoPiZer workflow.

If a prerelease newer than the latest stable release is available, its snippet will be included in the generated rpi-imager.json. Otherwise only the latest stable snippet will be included.

Can be used to automatically generate rpi-imager.json as part of a static page build.

Inputs

token

Required The GitHub token to use, should usually be set to secrets.GITHUB_TOKEN.

owner

Required The owner of the repository to monitor.

repo

Required The name of the repository to monitor.

output

Required The name of the output file to write rpi-imager.json to.

nameStable

If set, the name to give the stable release. Otherwise the name from the snippet will be used.

namePrerelease

If set, the name to give the prerelease. Otherwise the name from the snippet will be used.

initFormat

If set, the init_format to set on the entries. Otherwise whatever is in the snippet will be used.

ignoreRegex

If set and matches either a release's name or description, the release will be ignored.

versionRegex

If set, used to extract version numbers from a release's tag via named groups. These versions will then be used to determine whether prereleases predating the latest stable release are possibly actually still to be included as they contain newer software versions (and are just earlier builds).

Usage

.github/workflows/generate.yml:

name: "Generate rpi-imager.json"
on:
  schedule:
    - cron: "0 0 * * *"
  workflow_dispatch:

jobs:
  cleanup:
    runs-on: ubuntu-latest
    steps:
    # ...
    - uses: OctoPrint/actions/rpi-imager-json@main
      with:
        token: "${{ secrets.GITHUB_TOKEN }}"
        owner: OctoPrint
        repo: OctoPi-UpToDate
        ignoreRegex: "mark:untested"
        versionRegex: "^(?<octopi>.*?)-(?<octoprint>.*?)-\\d+$"
        output: ./files/rpi-imager.json
        nameStable: "OctoPi (stable)"
        namePrerelease: "OctoPi (prerelease)"
        initFormat: systemd
    # ...

Development

Local testing

export INPUT_TOKEN=...
export INPUT_OWNER=...
export INPUT_REPO=...
export INPUT_OUTPUT=...
node src/index.js

Build

npm run build