**Summary**
Make use of the new json output from the build page in order to obtain
more reliable results.
Additionally, get the tag from the package.yml stored in the latest commit
instead potentially tagging from any unstaged changes.
Lastly, take this opportunity to cleanup the script a little.
Previously the unstable repo had to be enabled and the use of sudo
was required to check if a package got indexed into the repo.
Now we download the index directly and compare to it if the build
succeeds. Additionally, this means we can always check when a package
gets indexed.
Previously if a package had to be republished it would get confused
by the previously failed build.
Now, we get the latest build id for the tag and check for that instead.
If the unstable repo is found then this script will also check up
to a minute if the package has been successfully indexed into the repo.
Some of the shortcomings of this approach are:
- The unstable repo can be called anything but is hardcoded here
- Updating the repo requires sudo access