Updated travis and added a helper script
parent
bd99e1bb55
commit
daf1b03fc2
15
.travis.yml
15
.travis.yml
|
@ -20,21 +20,8 @@ jobs:
|
|||
#- "ls -lah /tmp/build/"
|
||||
#- "ls -lah /tmp/build/logs/"
|
||||
#- "ls -lah /tmp/build/packages/"
|
||||
- "wget https://github.com/tfausak/github-release/releases/download/1.2.4/github-release-linux.gz -O git-release.gz -q && gunzip git-release.gz && chmod +x git-release;"
|
||||
- >
|
||||
mkdir -p /tmp/build/packages/;
|
||||
echo "XXXX" > /tmp/build/packages/xxxxx;
|
||||
export GIT_TAG=$(git rev-parse HEAD);
|
||||
export GIT_TAG_SHORT=$(git rev-parse --short HEAD);
|
||||
echo "Release commit: $GIT_TAG ($GIT_TAG_SHORT)";
|
||||
|
||||
export GITHUB_RELEASE_TAG="This is a auto build release from travis";
|
||||
export GITHUB_RELEASE_REPOSITORY="TeaSpeak/TeaWeb";
|
||||
export GITHUB_RELEASE_ACCESS_TOKEN="$GIT_AUTHTOKEN";
|
||||
export GITHUB_RELEASE_COMMIT="3dbcad0";
|
||||
/tmp/git-release "Travis autobuild $GIT_TAG_SHORT" /tmp/build/packages/xxxxx \
|
||||
--commit "3dbcad0" \
|
||||
--tag "12312123" \
|
||||
--github-access-token "$GIT_AUTHTOKEN" \
|
||||
--github-repository "TeaSpeak/TeaWeb";
|
||||
./scripts/travis_deploy.sh
|
||||
if: branch = master
|
|
@ -9,30 +9,39 @@ GIT_COMMIT_SHORT=$(git rev-parse --short HEAD)
|
|||
GIT_COMMIT_LONG=$(git rev-parse HEAD)
|
||||
echo "Deploying $GIT_COMMIT_SHORT ($GIT_COMMIT_LONG) to github."
|
||||
|
||||
cd /tmp/
|
||||
if [[ ! -x git-release ]]; then
|
||||
GIT_RELEASE_EXECUTABLE="/tmp/git-release"
|
||||
if [[ ! -x ${GIT_RELEASE_EXECUTABLE} ]]; then
|
||||
if [[ ! -f ${GIT_RELEASE_EXECUTABLE} ]]; then
|
||||
echo "Downloading github-release-linux (1.2.4)"
|
||||
wget https://github.com/tfausak/github-release/releases/download/1.2.4/github-release-linux.gz -O git-release.gz -q;
|
||||
|
||||
if [[ -f /tmp/git-release.gz ]]; then
|
||||
rm /tmp/git-release.gz
|
||||
fi
|
||||
wget https://github.com/tfausak/github-release/releases/download/1.2.4/github-release-linux.gz -O /tmp/git-release.gz -q;
|
||||
[[ $? -eq 0 ]] || {
|
||||
echo "Failed to download github-release-linux"
|
||||
exit 1
|
||||
}
|
||||
|
||||
gunzip git-release.gz && chmod +x git-release;
|
||||
gunzip /tmp/git-release.gz && chmod +x /tmp/git-release;
|
||||
[[ $? -eq 0 ]] || {
|
||||
echo "Failed to unzip github-release-linux"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ ! -x git-release ]]; then
|
||||
echo "Download of github-release-linux (1.2.4) finished"
|
||||
else
|
||||
chmod +x ${GIT_RELEASE_EXECUTABLE}
|
||||
fi
|
||||
|
||||
if [[ ! -x ${GIT_RELEASE_EXECUTABLE} ]]; then
|
||||
echo "git-release isn't executable"
|
||||
exit 1
|
||||
fi
|
||||
echo "Download of github-release-linux (1.2.4) finished"
|
||||
fi
|
||||
|
||||
echo "Generating release"
|
||||
./github-release release \
|
||||
${GIT_RELEASE_EXECUTABLE} release \
|
||||
--repo "TeaWeb" \
|
||||
--owner "TeaSpeak" \
|
||||
--token "${GIT_AUTHTOKEN}" \
|
||||
|
@ -46,15 +55,22 @@ echo "Generating release"
|
|||
|
||||
echo "Uploading release files"
|
||||
folders=("/tmp/build/logs/" "/tmp/build/packages/")
|
||||
uploaded_files=()
|
||||
|
||||
for folder in "${folders[@]}"; do
|
||||
echo "Scanning folder $folder"
|
||||
if [[ ! -d ${folder} ]]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
for file in ${folder}*; do
|
||||
if [[ -d ${file} ]]; then
|
||||
echo " Skipping directory `basename $file` ($file)"
|
||||
continue
|
||||
fi
|
||||
echo " Found entry $file. Uploading file.";
|
||||
./github-release upload \
|
||||
echo " Found entry `basename $file` ($file). Uploading file.";
|
||||
|
||||
${GIT_RELEASE_EXECUTABLE} upload \
|
||||
--repo "TeaWeb" \
|
||||
--owner "TeaSpeak" \
|
||||
--token "${GIT_AUTHTOKEN}" \
|
||||
|
@ -66,5 +82,9 @@ for folder in "${folders[@]}"; do
|
|||
echo "Failed to generate git release"
|
||||
exit 1
|
||||
}
|
||||
|
||||
uploaded_files+="$file"
|
||||
done
|
||||
done
|
||||
|
||||
echo "Successfully uploaded ${#uploaded_files[@]} files."
|
Loading…
Reference in New Issue