Created
May 8, 2020 22:19
-
-
Save virtualhobbit/dec8fc520ef416db4b1b5d456ad563be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export cf_server="myServer" | |
export cf_username="myUser" | |
export cf_password="myPassword" | |
export cf_category="c1001" | |
for i in $(ls *.js); | |
do | |
j=$(echo $i | cut -f 1 -d '.'); | |
jsdoc $i -d $j; | |
zip -r $j.zip $j/; | |
RESULT=$( curl -u $cf_username:$cf_password -X GET http://$cf_server/rest/docs/2.0/repository/$cf_category/findByName/$j | jq -r '.[] | .id' ); | |
if [ -z $RESULT ]; | |
then | |
curl -u $cf_username:$cf_password -X PUT --upload-file $j.zip http://$cf_server/rest/docs/2.0/repository/$cf_category/$j; | |
else | |
curl -u $cf_username:$cf_password -X POST -H "X-Atlassian-Token":"nocheck" --upload-file $j.zip http://$cf_server/rest/docs/2.0/repository/$cf_category-$RESULT; | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment