language: cpp
compiler: gcc
sudo: require
dist: xenial

if: tag IS present

before_install:
  - sudo apt-get update -qq

install:
  - sudo apt-get -y install valac python3-doit libxmlbird-dev libgee-0.8-dev libglib2.0-dev libgtk-3-dev libwebkit2gtk-4.0-dev libnotify-dev libsqlite3-dev

script:
  - ./configure --prefix=/usr
  - ./build.py
  - ./install.py -d appdir
  - wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
  - chmod a+x linuxdeployqt-continuous-x86_64.AppImage
  - ./linuxdeployqt-continuous-x86_64.AppImage --appimage-extract 'usr/bin/patchelf'
  - squashfs-root/usr/bin/patchelf --set-rpath '$ORIGIN' appdir/usr/lib/x86_64-linux-gnu/libbirdfont.so.*.*
  - ( cd appdir/usr/lib/ ; ln -s x86_64-linux-gnu/lib* . )
  - find appdir/
  - export LD_LIBRARY_PATH=./appdir/usr/lib:./appdir/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
  - |2
    ./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -appimage \
    -executable=appdir/usr/bin/birdfont-autotrace \
    -executable=appdir/usr/bin/birdfont-export \
    -executable=appdir/usr/bin/birdfont-import
  
after_success:
  - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
  - bash upload.sh Birdfont*.AppImage*
  
branches:
  except:
    - # Do not build tags that we create when we upload to GitHub Releases
    - /^(?i:continuous)/
