stages:
    - build
    - commit

package:
  stage: build
  script:
    - mkdir -p /etc/pkg
    - cp ./pkg.cfg /etc/pkg/pkg.cfg
    - cp ./pacman.conf.builder /etc/pacman.conf.builder
    - pkg-prepare.sh
    - pkg-build.sh --chdir=trunk $CI_PROJECT_DIR

  artifacts:
    name: $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA
    paths:
     - "*.pkg.tar.xz"

  only:
    changes:
      - trunk/PKGBUILD

commit:
  stage: commit
  only:
    changes:
      - trunk/PKGBUILD

  script:
    - pkg-commit.sh
