Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Commit

Permalink
ci(version): add script to update version list
Browse files Browse the repository at this point in the history
Signed-off-by: Naylin Medina <[email protected]>
  • Loading branch information
Naylin15 committed Oct 8, 2018
1 parent 214ec12 commit 325d33c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
Empty file added _data/whitelist_version.yml
Empty file.
46 changes: 46 additions & 0 deletions ci/update_version_list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash

COMMIT_MESSAGE=$(git log --pretty=oneline -n 1 $CIRCLE_SHA1)

# only update list when documentation is updated
if [[ $COMMIT_MESSAGE == *"ci(docs): generate documentation with jazzy for version"* && -z "$CIRCLE_PULL_REQUEST" ]]; then

# check if support folder exists
if [ -d "development/code-documentation/support" ]; then

# remove list to create a new one and not duplicate folders
rm ./_data/whitelist_version.yml

# create fresh list
touch ./_data/whitelist_version.yml

# set path to directory where the versions folders are
FOLDER_PATH="development/code-documentation/support"

# get folders in release directory
DIRS=`ls $FOLDER_PATH`

# add version folders to list
for DIR in $DIRS
do
echo - ${DIR} >> ./_data/whitelist_version.yml
done
# if the list has changed commit and push changes
if [ -n "$(git status --porcelain _data/whitelist_version.yml)" ]; then

echo "Updating version list"

# configure git
git config --global user.email "[email protected]"
git config --global user.name "Teclib' bot"

# add new remote to push changes
git remote remove origin
git remote add origin https://$GITHUB_USER:$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git

git add _data/whitelist_version.yml && git commit -m "ci(list): update version list"
git push origin gh-pages
fi
fi

fi

0 comments on commit 325d33c

Please sign in to comment.