#!/bin/bash

# maven-scm-publish-plugin feeds sh too many arguments, so we have to
# do this ourselves

site_dir=$1
tmp_dir=$2
version=$3

git clone git@github.com:wildfly-swarm/wildfly-swarm.git $tmp_dir
cd $tmp_dir
git checkout gh-pages
git pull
rsync -avz $site_dir/ $tmp_dir
git add $version

if grep -q "$version\$" _data/versions.yml; then
    echo "$version exists in _data/versions.yml"
else
    echo -e "\n- $version" >> _data/versions.yml
    git add _data/versions.yml
fi
 
git commit -m "CI generated API documentation for $version"
git push origin gh-pages

#!/bin/bash

# maven-scm-publish-plugin feeds sh too many arguments, so we have to
# do this ourselves

site_dir=$1
tmp_dir=$2
version=$3

git clone git@github.com:wildfly-swarm/wildfly-swarm-javadocs.git $tmp_dir
cd $tmp_dir
git checkout gh-pages
git pull
rsync -avz $site_dir/ $tmp_dir
git add $version

if grep -q "$version\$" _data/versions.yml; then
    echo "$version exists in _data/versions.yml"
else
    echo -e "\n- $version" >> _data/versions.yml
    git add _data/versions.yml
fi
 
git commit -m "CI generated API documentation for $version"
git push origin gh-pages

Use new javadocs repo instead of wildfly-swarm:gh-pages
Use new javadocs repo instead of wildfly-swarm:gh-pages

Adding the docs to this repo for every build means everyone that pulls
wildfly-swarm has to download the updated docs if CI has built since
their last pull, which is time-consuming. Moving the docs out to a repo
that most devs will never need to pull solves that.
