Skip to content

Instantly share code, notes, and snippets.

@Elix-x
Last active December 2, 2016 20:38
Show Gist options
  • Save Elix-x/f30b594362b94d55ca3c2e3233c9e4e1 to your computer and use it in GitHub Desktop.
Save Elix-x/f30b594362b94d55ca3c2e3233c9e4e1 to your computer and use it in GitHub Desktop.
Travis - Maven artifacts deployment to github pages
#!/bin/bash
USER="<USERNAME>"
NAME="<NAME OF PROJECT>"
GROUP="<GROUP (WITH SLASHES '/' !!!)>"
git config --global user.email "$USER@users.noreply.github.com"
git config --global user.name "Travis-Maven"
git clone https://$USER:$GITACCESSTOKEN@github.com/$USER/$USER.github.io.git
mkdir -p "$USER.github.io/maven2/$GROUP/$NAME/$TRAVIS_BRANCH/"
cp -r "./build/libs/." "./$USER.github.io/maven2/$GROUP/$NAME/$TRAVIS_BRANCH/"
cd "$USER.github.io"
git add *
git commit -m "Uploading maven artifacts for $NAME for $TRAVIS_BRANCH"
git push
cd ./..
rm -rf "$USER.github.io"
@Elix-x
Copy link
Author

Elix-x commented Dec 2, 2016

This script allows automatic travis deployment of maven artifacts to maven repository hosted on github pages (under maven2).

In the script, you must set USER, NAME and GROUP fields.

Field Description
USER Your Github username
NAME Name of project
GROUP Same group you defined in pom, but with slashes / instead of dots .

With Travis, add to deployment custom script provider calling the script:

  - provider: script
    script: /bin/sh ./gitwebpages.sh

And obviously (at least i hope so), you must have a github pages repository already created on username.github.io.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment