usimd / pi-gen-action

Action to build Raspberry Pi images using official pi-gen tool
MIT License
35 stars 9 forks source link

Add example for exporting multiple image stages #123

Open Mearman opened 2 months ago

Mearman commented 2 months ago

Thank you for such a helpful action!

I'm building an image that just adds one main package (and its dependencies) and then the package's config, as well as updating /boot/firmware/config.txt.

I would like to export the Lite and Full images, but I'm not sure what the best approach is without repeating the whole job.

Is there a better way to do it than something like the following:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: usimd/pi-gen-action@v1
        id: base
        with:
          stage-list: stage0 stage1 ./custom-stage

    - uses: usimd/pi-gen-action@v1
        id: stage2
        with:
          stage-list: stage2
              - uses: usimd/pi-gen-action@v1

    - uses: actions/upload-artifact@v4
      with:
        name: lite-image
        path: ${{ steps.stage2.outputs.image-path }}

    - uses: usimd/pi-gen-action@v1
        id: stage3
        with:
          stage-list: stage3

    - uses: actions/upload-artifact@v4
      with:
        name: full-image
        path: ${{ steps.stage3.outputs.image-path }}
Mearman commented 2 months ago

Just found the appropriate section in the readme. Though an example would be useful

usimd commented 2 months ago

Thanks for reaching out.

Fully agree, this requires some in-depth understanding of pi-gen's internals and could be made easier for beginners.

Would you like to contribute a suggestion in a PR?

Mearman commented 2 months ago

I'm still fumbling through myself, but I'm getting somewhere. Though do you know what paths I'd need to cache to speed up the pipelines?

usimd commented 2 months ago

pi-gen is by design incremental. Each stage builds upon the previous and you just tell it at which point to export the snapshot to an image.

Caching of the working directory does make sense for repeated development runs of the action, I'm passively working on a feature to introduce that in #106.

But if you want to export multiple images with the same content incrementally adding other components, it's really just one plain pi-gen run you need.

usimd commented 1 month ago

Did you figure out everything to get your build goinf, @Mearman? Is there anything missing the documentation or something you'd suggest to improve?