---
name: "release"

on:
  push:
    branches:
      - "main"

jobs:
  release:
    name: "Release"
    runs-on: "ubuntu-22.04"

    steps:
      - name: Install dependencies (apk)
        run: sudo apt update && sudo apt-get install -y git python3 py3-pip zlib python3-pillow

      - uses: actions/checkout@v2
        with:
          submodules: true

      - name: prep
        run: mkdir -p /tmp/pinecil && mkdir -p /tmp/miniware

      - name: build all files for the device
        run: cd Bootup\ Logos && ./run.sh /tmp/pinecil/ -p && ./run.sh /tmp/miniware/ -m

      - name: build logo erase file
        run: cd Bootup\ Logos && python3 img2logo.py -E erase_stored_image /tmp/pinecil/ -p && python3 img2logo.py -E erase_stored_image /tmp/miniware/ -m

      - name: compress logo files
        run: zip -r pinecil.zip /tmp/pinecil/* && zip -r miniware.zip /tmp/miniware/*

      - uses: "marvinpinto/action-automatic-releases@latest"
        with:
          repo_token: "${{ secrets.GITHUB_TOKEN }}"
          automatic_release_tag: "latest"
          prerelease: false
          title: "Release"
          files: |
            *.zip
