
on:
 workflow_dispatch:

jobs:
 dbuild:
  runs-on: ubuntu-22.04
  steps:
   - uses: actions/checkout@v3
     with:
      path: in
   - uses: actions/checkout@master
     with:
      repository: colin-i/sync
      path: in2
      ref: actionswf
   - name: Run a multi-line script
     run: |
      mv in2/debian/patches in/debian/patches
      mv in2/.pc in/.pc
      sudo dpkg --add-architecture i386
      if [ -z "`dpkg -s devscripts>/dev/null 2>&1 && echo x`" ]; then
       sudo add-apt-repository -y ppa:colin-i/ppa
       sudo apt install -y devscripts debhelper ocompiler
      fi
      name=`cat in/debian/changelog | head -1 | grep -o ^[^\ ]*`
      origf=${name}-1.tar.gz
      if [ ! -e "${origf}" ]; then
       origln=${name}_1.orig.tar.gz
       wget https://ppa.launchpadcontent.net/colin-i/ppa/ubuntu/pool/main/a/${name}/${origln} -O ${origf}
       ln -s ${origf} ${origln}
      fi
      cd in
      debuild -S -us -uc
   - name: unsigned debs
     uses: actions/upload-artifact@v4
     with:
      name: sdebs
      path: |
       ./*.dsc
       ./*.changes
       ./*.buildinfo
       ./*.debian.tar.xz
