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

Development section #160

Merged
merged 8 commits into from
Oct 8, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ci(version): add script to update version list
Signed-off-by: Naylin Medina <nmedina@teclib.com>
  • Loading branch information
Naylin15 committed Oct 5, 2018
commit d205d63d8cf8dbc89e69d36e2874c9f7086a19c7
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 "apps@teclib.com"
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