platform: linux/amd64
branches: [dev]

pipeline:
  build:
    image: 'archlinux:latest'
    commands:
      # Update packages
      - pacman -Syu --needed --noconfirm base-devel
      # Create non-root user to perform build & switch to their home
      - groupadd -g 1000 builder
      - useradd -mg builder builder
      - chown -R builder:builder "$PWD"
      - "echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
      - su builder
      # Build the package
      - makepkg -s --noconfirm --needed

  publish:
    image: 'archlinux:latest'
    commands:
      # Publish the package
      - 'for pkg in $(ls -1 *.pkg*); do curl -XPOST -T "$pkg" -H "X-API-KEY: $VIETER_API_KEY" https://arch.r8r.be/publish; done'
    secrets:
      - vieter_api_key