Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d654ccc

Browse files
committed
Changed the target location for published documentation.
Now it's published into main utplsql.gihub.io repository.
1 parent 42053b4 commit d654ccc

3 files changed

Lines changed: 33 additions & 37 deletions

File tree

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ env:
3030
- CURRENT_BRANCH=${TRAVIS_BRANCH}
3131
- UTPLSQL_REPO="utPLSQL/utPLSQL"
3232
- UTPLSQL_BUILD_NO="${TRAVIS_BUILD_NUMBER:-0}"
33-
- UTPLSQL_VERSION_PATTERN="v?([0-9]+\.){3}[0-9]+[^']*"
3433
- UTPLSQL_VERSION=$(. .travis/get_project_version.sh)
3534
- UTPLSQL_BUILD_VERSION=$(. .travis/get_project_build_version.sh)
3635
- UTPLSQL_SOURCES_DIR='source'
@@ -115,16 +114,15 @@ jobs:
115114
- pip install mkdocs
116115
before_script: skip
117116
script:
118-
- if [[ ($TRAVIS_BRANCH == develop) && ($TRAVIS_PULL_REQUEST == false) ]]; then bash .travis/trigger_travis.sh $TRAVIS_ACCESS_TOKEN; fi
119-
- #The update_project_version.sh needs to be done before pushing changes to develop branch
120117
- bash .travis/update_project_version.sh
121118
- git config --global user.email "[email protected]"
122119
- git config --global user.name "${UTPLSQL_BUILD_USER_NAME}"
123120
- git remote rm origin
124121
- git remote add origin https://${github_api_token}@github.com/${UTPLSQL_REPO}
125122
- if [[ ! $TRAVIS_TAG ]]; then bash .travis/push_release_version.sh; fi
123+
- bash .travis/push_docs_to_github_io.sh
126124
- bash .travis/build_docs.sh
127-
- bash .travis/push_docs_to_gh_pages.sh
125+
- if [[ ($TRAVIS_BRANCH == develop) && ($TRAVIS_PULL_REQUEST == false) ]]; then bash .travis/trigger_travis.sh $TRAVIS_ACCESS_TOKEN; fi
128126
before_deploy:
129127
- bash .travis/build_release_archive.sh
130128
deploy:
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Many aspects of this came from https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
3+
# Based on `push_docs_to_gh_pages.sh`
44
# Significant alterations
55
# - Support for multiple copies of documentation,
66
# - only clearing out develop
@@ -13,59 +13,55 @@
1313
# - File: "docs/index.md" with that contains develop docs
1414

1515
# Required ENV Variables
16-
PAGES_TARGET_BRANCH="gh-pages"
1716
LATEST_DOCS_BRANCH="develop"
17+
GITHUB_IO_REPO='jgebal/jgebal.github.io'
18+
GITHUB_IO_BRANCH='master'
19+
1820
# TRAVIS_* variables are set by travis directly and only need to be if testing externally
1921

20-
# We don't want a pull request automatically updating the repository
22+
# We deploy only when building on develop branch or on TAG (release)
2123
if [ "$TRAVIS_PULL_REQUEST" == "false" ] && { [ "${CURRENT_BRANCH}" == "${LATEST_DOCS_BRANCH}" ] || [ -n "${TRAVIS_TAG}" ]; }; then
2224

2325
# ENV Variable checks are to help with configuration troubleshooting, they silently exit with unique message.
2426
# Anyone one of them not set can be used to turn off this functionality.
2527

2628
# If a version of the project is not defined
27-
[[ -n "${UTPLSQL_VERSION}" ]] || { echo "variable UTPLSQL_VERSION is not defines or missing value"; exit 0; }
29+
[[ -n "${UTPLSQL_VERSION}" ]] || { echo "variable UTPLSQL_VERSION is not defines or missing value"; exit 1; }
2830
# Fail if the markdown documentation is not present.
2931
[[ -f ./docs/index.md ]] || { echo "file docs/index.md not found"; exit 1; }
3032

31-
# Save some useful information
33+
# Store latest commit SHA to be used when committing and pushing to github.io repo
3234
SHA=`git rev-parse --verify HEAD`
3335

34-
# clone the repository and switch to PAGES_TARGET_BRANCH branch
36+
# clone the repository and switch to GITHUB_IO_BRANCH branch
3537
mkdir pages
36-
cd pages
37-
git clone https://${github_api_token}@github.com/${UTPLSQL_REPO} .
38-
39-
PAGES_BRANCH_EXISTS=$(git ls-remote --heads origin ${PAGES_TARGET_BRANCH})
38+
cd ./pages
39+
git clone --depth 1 https://${github_api_token}@github.com/${GITHUB_IO_REPO} -b ${GITHUB_IO_BRANCH} .
4040

41-
if [ -n "$PAGES_BRANCH_EXISTS" ] ; then
42-
echo "Pages Branch Found"
43-
git checkout ${PAGES_TARGET_BRANCH}
44-
else
45-
echo "Creating Pages Branch"
46-
git checkout --orphan ${PAGES_TARGET_BRANCH}
47-
git rm -rf .
48-
fi
41+
mkdir -p utPLSQL
42+
cd ./utPLSQL
4943
#clear out develop documentation directory and copy docs contents to it.
50-
echo "updating 'develop' directory"
51-
mkdir -p develop
52-
rm -rf develop/**./* || exit 0
53-
cp -a ../docs/. ./develop
44+
echo "updating 'develop' documentation directory"
45+
mkdir -p ./develop
46+
rm -rf ./develop/**./* || exit 0
47+
cp -a ../../docs/. ./develop
48+
5449
# If a Tagged Build then copy to it's own directory as well and to the 'latest' release directory
5550
if [ -n "$TRAVIS_TAG" ]; then
56-
echo "Creating ${UTPLSQL_VERSION}"
57-
mkdir -p ${UTPLSQL_VERSION}
58-
rm -rf ${UTPLSQL_VERSION}/**./* || exit 0
59-
cp -a ../docs/. ${UTPLSQL_VERSION}
60-
echo "Populating 'latest' directory"
61-
mkdir -p latest
62-
rm -rf latest/**./* || exit 0
63-
cp -a ../docs/. latest
51+
echo "Creating directory ./${UTPLSQL_VERSION}"
52+
mkdir -p ./${UTPLSQL_VERSION}
53+
rm -rf ./${UTPLSQL_VERSION}/**./* || exit 0
54+
cp -a ../../docs/. ./${UTPLSQL_VERSION}
55+
echo "Populating 'latest' directory"
56+
mkdir -p ./latest
57+
rm -rf ./latest/**./* || exit 0
58+
cp -a ../../docs/. ./latest
6459
fi
6560
# Stage changes for commit
6661
git add .
62+
6763
#Check if there are doc changes, if none exit the script
68-
if [[ -z `git diff HEAD --exit-code` ]] && [ -n "${PAGES_BRANCH_EXISTS}" ] ; then
64+
if [[ -z `git diff HEAD --exit-code` ]]; then
6965
echo "No changes to docs detected."
7066
exit 0
7167
fi
@@ -75,7 +71,7 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" ] && { [ "${CURRENT_BRANCH}" == "${LATEST
7571
echo "---" >>index.md
7672
echo "layout: default" >>index.md
7773
echo "---" >>index.md
78-
echo "<!-- Auto generated from .travis/push_docs_to_gh_pages.sh -->" >>index.md
74+
echo "<!-- Auto generated from .travis/push_docs_to_github_io.sh -->" >>index.md
7975
echo "# Documentation versions" >>index.md
8076
echo "" >>index.md
8177
echo "" >>index.md #- 7th line - placeholder for latest release doc
@@ -96,6 +92,6 @@ if [ "$TRAVIS_PULL_REQUEST" == "false" ] && { [ "${CURRENT_BRANCH}" == "${LATEST
9692
git add .
9793
git commit -m "Deploy to gh-pages branch: base commit ${SHA}"
9894
# Now that we're all set up, we can push.
99-
git push --quiet origin HEAD:${PAGES_TARGET_BRANCH}
95+
git push --quiet origin HEAD:${GITHUB_IO_BRANCH}
10096
fi
10197

.travis/update_project_version.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
UTPLSQL_VERSION_PATTERN="v?([0-9]+\.){3}[0-9]+[^']*"
4+
35
echo Current branch is "${CURRENT_BRANCH}"
46

57
echo Update version in project source files

0 commit comments

Comments
 (0)