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

Commit

Permalink
ci(docs): generate docs independently
Browse files Browse the repository at this point in the history
Signed-off-by: Hector Rondon <[email protected]>
  • Loading branch information
Hector Rondon committed Sep 17, 2018
1 parent 82794c1 commit c0f2ff6
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 12 deletions.
33 changes: 21 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ references:
store_artifacts:
path: ./$APPNAME.ipa

create_documentation: &create_documentation
run:
name: Generate documentation
command: source ci/scripts/documentation.sh
environment:
DOCUMENTATION_DESTINATION: development/code-documentation/

jobs:
build:
<<: *container_config
Expand All @@ -102,6 +109,16 @@ jobs:
- *set_locate
- *fastlane_config
- *test_app

documentation:
<<: *container_config
steps:
- checkout
- *bundler_config
- *install
- *set_locate
- *git_config
- *create_documentation

deploy_develop:
<<: *container_config
Expand Down Expand Up @@ -136,25 +153,17 @@ jobs:

workflows:
version: 2
build-and-test:
build-test-deploy:
jobs:
- build
- test:
filters:
branches:
ignore:
- develop
- deploy_develop:
requires:
- build
filters:
branches:
only:
- develop
- deploy_master:
- documentation:
requires:
- test
filters:
branches:
only:
only:
- master
- develop
42 changes: 42 additions & 0 deletions ci/scripts/documentation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

if [[ $CIRCLE_BRANCH == "develop" ]]; then

# Get old version number from package.json
export GIT_OLD_TAG=$(jq -r ".version" package.json)
# Generate CHANGELOG.md and increment version
IS_PRERELEASE="$( cut -d '-' -f 2 <<< "$GIT_OLD_TAG" )";

if [[ $GIT_OLD_TAG != "$IS_PRERELEASE" ]]; then

PREFIX_PRERELEASE="$( cut -d '.' -f 1 <<< "$IS_PRERELEASE" )";
yarn release -t '' --skip.changelog=true --skip.tag=true -m "ci(release): generate CHANGELOG.md for version %s" --prerelease "$PREFIX_PRERELEASE"

else

yarn release -t '' --skip.changelog=true --skip.tag=true -m "ci(release): generate CHANGELOG.md for version %s"

fi

fi

# Get version number from package.json
export GIT_TAG=$(jq -r ".version" package.json)
# Update CFBundleShortVersionString
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${GIT_TAG}" ${PWD}/${APPNAME}/Info.plist
# Update CFBundleVersion
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CIRCLE_BUILD_NUM" ${PWD}/${APPNAME}/Info.plist
# Add modified and delete files
git add ${APPNAME}/Info.plist
git commit --amend --no-edit

echo "Generate documentation with jazzy"
# Generate documentation with jazzy
jazzy
mv docs/ code-documentation/
# Add docs folder
git add code-documentation -f
# Create commit, NOTICE: this commit is not sent
git commit -m "ci(docs): generate **docs** for version ${GIT_TAG}"
# Update documentation on gh-pages branch
yarn gh-pages --dist code-documentation --dest "${DOCUMENTATION_DESTINATION}${CIRCLE_BRANCH}" -m "ci(docs): generate documentation with jazzy for version ${GIT_TAG}"

0 comments on commit c0f2ff6

Please sign in to comment.