Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0354c1a
First attempt at running as github actions
jgebal Nov 24, 2021
de73451
Building github actions
jgebal Nov 24, 2021
1c3004a
Adding OJDBC Download
jgebal Nov 25, 2021
0b9f937
Adding TimeZone
jgebal Nov 25, 2021
0ce0368
Adding 21xe-full
jgebal Nov 25, 2021
4921610
Switching to 21c-xe-slim
jgebal Nov 30, 2021
09d3261
Fixing build numbers and sonar analysis configuration.
jgebal Dec 2, 2021
e3e8c79
Added update of project version and build number.
jgebal Jan 4, 2022
e841b9b
Fixing docs update
jgebal Jan 5, 2022
cae6a35
Update env variables
jgebal Jan 5, 2022
7e87558
Formatting and cleanup
jgebal Jan 5, 2022
9307524
Adding publishing of project version updates
jgebal Jan 5, 2022
169f61c
Update of token
jgebal Jan 6, 2022
82c4d21
Testing publishing of documentation to gh-pages
jgebal Jan 6, 2022
532be8d
Externalizing env variables.
jgebal Jan 6, 2022
12757ea
Added job names.
jgebal Jan 7, 2022
ddd3862
Fixing multi-line if statement.
jgebal Jan 7, 2022
5b64836
Implementing Release Action
jgebal Jan 7, 2022
28cdee3
Refactoring and adding dispatch of other repositories
jgebal Jan 8, 2022
0e6eb70
Testing triggering of build process on other repositories
jgebal Jan 9, 2022
06f3556
Enabling build and slack notification
jgebal Jan 10, 2022
6cd8b16
Update documentation publish condition
jgebal Jan 10, 2022
1fc87de
Enable dependency on downstream job dispatch
jgebal Jan 10, 2022
31cc42d
Final cleanup of travis build leftovers.
jgebal Jan 13, 2022
b94a3f7
Addding `utPLSQL-java-api` repo to dispatch post-build.
jgebal Jan 14, 2022
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
Testing publishing of documentation to gh-pages
  • Loading branch information
jgebal committed Jan 13, 2022
commit 82c4d21a97c29d6fa85df65d9688ad1b70e4677f
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,24 @@ jobs:
)
}}

- name: Copy and push documentation to utPLSQL-github-io repo
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
run: .travis/push_docs_to_github_io.sh
shell: bash
if: |
${{
github.repository == 'utPLSQL/utPLSQL'
&& (github.ref_type == 'branch'
&& ( startsWith(env.CURRENT_BRANCH,'release/')
|| env.CURRENT_BRANCH == 'develop'
|| env.CURRENT_BRANCH == 'feature/github_actions'
)
|| github.ref_type == 'tag'
)
}}



# TODO - add slack notifications
# TODO - add push of documentation
Expand Down
134 changes: 66 additions & 68 deletions .travis/push_docs_to_github_io.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,81 +17,79 @@ LATEST_DOCS_BRANCH="develop"
GITHUB_IO_REPO='utPLSQL/utPLSQL.github.io'
GITHUB_IO_BRANCH='main'

# TRAVIS_* variables are set by travis directly and only need to be if testing externally

# We deploy only when building on develop branch or on TAG (release)
if [ "${PULL_REQUEST_NAME}" == "false" ] && { [ "${CURRENT_BRANCH}" == "${LATEST_DOCS_BRANCH}" ] || [ -n "${TAG_NAME}" ]; }; then
# ENV Variable checks are to help with configuration troubleshooting, they silently exit with unique message.
# Anyone one of them not set can be used to turn off this functionality.

# ENV Variable checks are to help with configuration troubleshooting, they silently exit with unique message.
# Anyone one of them not set can be used to turn off this functionality.
# If a version of the project is not defined
[[ -n "${UTPLSQL_VERSION}" ]] || { echo "variable UTPLSQL_VERSION is not defines or missing value"; exit 1; }
# Fail if the markdown documentation is not present.
[[ -f ./docs/index.md ]] || { echo "file docs/index.md not found"; exit 1; }

# If a version of the project is not defined
[[ -n "${UTPLSQL_VERSION}" ]] || { echo "variable UTPLSQL_VERSION is not defines or missing value"; exit 1; }
# Fail if the markdown documentation is not present.
[[ -f ./docs/index.md ]] || { echo "file docs/index.md not found"; exit 1; }
# Store latest commit SHA to be used when committing and pushing to github.io repo
SHA=`git rev-parse --verify HEAD`

# Store latest commit SHA to be used when committing and pushing to github.io repo
SHA=`git rev-parse --verify HEAD`
# clone the repository and switch to GITHUB_IO_BRANCH branch
mkdir pages
cd ./pages
git clone --depth 1 https://${API_TOKEN_GITHUB}@github.com/${GITHUB_IO_REPO} -b ${GITHUB_IO_BRANCH} .

# clone the repository and switch to GITHUB_IO_BRANCH branch
mkdir pages
cd ./pages
git clone --depth 1 https://${github_api_token}@github.com/${GITHUB_IO_REPO} -b ${GITHUB_IO_BRANCH} .
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"

mkdir -p utPLSQL
cd ./utPLSQL
#clear out develop documentation directory and copy docs contents to it.
echo "updating 'develop' documentation directory"
mkdir -p ./develop
rm -rf ./develop/**./* || exit 0
cp -a ../../docs/. ./develop
mkdir -p utPLSQL
cd ./utPLSQL
#clear out develop documentation directory and copy docs contents to it.
echo "updating 'develop' documentation directory"
mkdir -p ./develop
rm -rf ./develop/**./* || exit 0
cp -a ../../docs/. ./develop

# If a Tagged Build then copy to it's own directory as well and to the 'latest' release directory
if [ -n "${TAG_NAME}" ]; then
echo "Creating directory ./${UTPLSQL_VERSION}"
mkdir -p ./${UTPLSQL_VERSION}
rm -rf ./${UTPLSQL_VERSION}/**./* || exit 0
cp -a ../../docs/. ./${UTPLSQL_VERSION}
echo "Populating 'latest' directory"
mkdir -p ./latest
rm -rf ./latest/**./* || exit 0
cp -a ../../docs/. ./latest
fi
# Stage changes for commit
git add .
# If a Tagged Build then copy to it's own directory as well and to the 'latest' release directory
if [ "${GITHUB_REF_TYPE}" == "tag" ]; then
echo "Creating directory ./${UTPLSQL_VERSION}"
mkdir -p ./${UTPLSQL_VERSION}
rm -rf ./${UTPLSQL_VERSION}/**./* || exit 0
cp -a ../../docs/. ./${UTPLSQL_VERSION}
echo "Populating 'latest' directory"
mkdir -p ./latest
rm -rf ./latest/**./* || exit 0
cp -a ../../docs/. ./latest
fi
# Stage changes for commit
git add .

#Check if there are doc changes, if none exit the script
if [[ -z `git diff HEAD --exit-code` ]]; then
echo "No changes to docs detected."
exit 0
fi
#Changes where detected, so we need to update the version log.
now=$(date +"%d %b %Y - %r")
if [ ! -f index.md ]; then
echo "---" >>index.md
echo "layout: default" >>index.md
echo "---" >>index.md
echo "<!-- Auto generated from .travis/push_docs_to_github_io.sh -->" >>index.md
echo "# Documentation versions" >>index.md
echo "" >>index.md
echo "" >>index.md #- 7th line - placeholder for latest release doc
echo "" >>index.md #- 8th line - placeholder for develop branch doc
echo "" >>index.md
echo "## Released Version Doc History" >>index.md
echo "" >>index.md
fi
#If build running on a TAG - it's a new release - need to add it to documentation
if [ -n "${TAG_NAME}" ]; then
sed -i '7s@.*@'" - [Latest ${TAG_NAME} documentation](latest/) - Created $now"'@' index.md
#add entry to the top of version history (line end of file - ## Released Version Doc History
sed -i '12i'" - [${TAG_NAME} documentation](${UTPLSQL_VERSION}/) - Created $now" index.md
fi
#replace 4th line in log
sed -i '8s@.*@'" - [Latest development version](develop/) - Created $now"'@' index.md
#Add and Commit the changes back to pages repo.
git add .
git commit -m "Deploy to gh-pages branch: base commit ${SHA}"
# Now that we're all set up, we can push.
git push --quiet origin HEAD:${GITHUB_IO_BRANCH}
#Check if there are doc changes, if none exit the script
if [[ -z `git diff HEAD --exit-code` ]]; then
echo "No changes to docs detected."
exit 0
fi
#Changes where detected, so we need to update the version log.
now=$(date +"%d %b %Y - %r")
if [ ! -f index.md ]; then
echo "---" >>index.md
echo "layout: default" >>index.md
echo "---" >>index.md
echo "<!-- Auto generated from .travis/push_docs_to_github_io.sh -->" >>index.md
echo "# Documentation versions" >>index.md
echo "" >>index.md
echo "" >>index.md #- 7th line - placeholder for latest release doc
echo "" >>index.md #- 8th line - placeholder for develop branch doc
echo "" >>index.md
echo "## Released Version Doc History" >>index.md
echo "" >>index.md
fi
#If build running on a TAG - it's a new release - need to add it to documentation
if [ "${GITHUB_REF_TYPE}" == "tag" ]; then
sed -i '7s@.*@'" - [Latest ${CURRENT_BRANCH} documentation](latest/) - Created $now"'@' index.md
#add entry to the top of version history (line end of file - ## Released Version Doc History
sed -i '12i'" - [${CURRENT_BRANCH} documentation](${UTPLSQL_VERSION}/) - Created $now" index.md
fi
#replace 4th line in log
sed -i '8s@.*@'" - [Latest development version](develop/) - Created $now"'@' index.md
#Add and Commit the changes back to pages repo.
git add .
git commit -m "Deploy to gh-pages branch: base commit ${SHA}"
# Now that we're all set up, we can push.
git push --quiet origin HEAD:${GITHUB_IO_BRANCH}