name: TileOS Sway ISO Builder
on: [workflow_call]
jobs:
 build:
  runs-on: [iso-builder]
  container:
   image: catthehacker/ubuntu:act-22.04
   options: --privileged

  steps:
   -
    name: Build image with sway
    run: |
     eval $(ssh-agent -s)
     mkdir /root/.ssh
     echo "${{ secrets.STORAGE_SSH_KEY }}" > ./id_rsa
     chmod 400 ~/.ssh/id_rsa
     rm -rf ${PWD}/output/*
     mkdir ${PWD}/output
     docker run --privileged --rm -i -v ${PWD}/output:/builder/builds -v /proc:/proc builder:latest ./build --desktop sway --release testing
     ssh -o StrictHostKeyChecking=no ${{ secrets.STORAGE_USER}}@${{ secrets.STORAGE_HOST }} -p ${{ secrets.STORAGE_PORT}} -i ~/.ssh/id_rsa rm -rf /media/iso/tile-os/testing/sway/*
     scp -o StrictHostKeyChecking=no -o Port=${{ secrets.STORAGE_PORT }} -o IdentityFile=/builder/id_rsa -p -B ${PWD}/output/amd64/* ${{ secrets.STORAGE_USER }}@${{ secrets.STORAGE_HOST }}:/media/iso/tile-os/testing/sway/