#!/bin/sh

MAJOR_MINOR="{{ version.major }}.{{ version.minor }}"

pip install --user antsibull
git clone git@github.com:ansible-community/ansible-build-data
mkdir built
if test -e "ansible-build-data/${MAJOR_MINOR}/ansible-${MAJOR_MINOR}.build" ; then
  BUILDFILE="ansible-build-data/${MAJOR_MINOR}/ansible-${MAJOR_MINOR}.build"
else
  BUILDFILE="ansible-build-data/${MAJOR_MINOR}/acd-${MAJOR_MINOR}.build"
fi
antsibull-build rebuild-single "{{ version }}" --build-file "$BUILDFILE" --dest-dir built

#pip install twine
#twine upload "built/ansible-{{ version }}.tar.gz"
