image: archlinux
packages:
  - dbus
  - gobject-introspection
  - gtk3
  - mpv
  - python-cairo
  - python-gobject
  - python-poetry
  - xorg-server-xvfb
sources:
  - https://git.sr.ht/~sumner/sublime-music
secrets:
  # PyPi Deploy Credentials for Sublime Music
  - b4190b11-fdf7-4cee-b939-ea9fce44fa12
environment:
  REPO_NAME: sublime-music
triggers:
  - action: email
    condition: failure
    to: ~sumner/sublime-music-devel@lists.sr.ht
tasks:
  - setup: |
      cd ${REPO_NAME}
      poetry install
      echo "cd ${REPO_NAME}" >> ~/.buildenv
      echo "source $(poetry env info -p)/bin/activate" >> ~/.buildenv

  - build: |
      poetry build

  - test-deploy-pypi: |
      poetry publish --dry-run

  - deploy-pypi: |
      ./cicd/tagged_with_version || echo "Skipping deploy since not tagged with version"
      ./cicd/tagged_with_version || complete-build
      poetry publish
