Skip to content

Commit

Permalink
Switch docs deployment from Travis CI to GitHub Actions (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
gopi487krishna authored Mar 2, 2021
1 parent f18445f commit 0778069
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/actions/docs-prerequisites/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: 'Get Docs Prerequisites'
description: 'Downloads all the necessary packages for building documentation'
runs:
using: composite
steps:
- run: sudo apt-get install doxygen python3 python3-pip python3-setuptools python3-sphinx
shell: bash
17 changes: 17 additions & 0 deletions .github/actions/generate-publish-doc/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Generate Doc'
description: 'Runs b2 on lib/gil/doc to generate documentation'
inputs:
github_token:
description: 'Github Token for Access'
required: true
runs:
using: composite
steps:
- run: |
echo "using doxygen ;" > ~/user-config.jam
cd ../boost-root/libs
../b2 gil/doc
cd gil
chmod +x $GITHUB_WORKSPACE/.github/actions/generate-publish-doc/upload-script.sh
$GITHUB_WORKSPACE/.github/actions/generate-publish-doc/upload-script.sh ${{inputs.github_token}}
shell: bash
40 changes: 40 additions & 0 deletions .github/actions/generate-publish-doc/upload-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
set -e # Exit with Non Zero exit Code

# Save some useful information
SHA=`git rev-parse --verify HEAD`

mkdir temp-doc
cd temp-doc
git init

git config user.name "Github Action Upload Docs"
git config user.email "Github Action Upload Docs"

git remote add upstream "https://$1@github.com/boostorg/gil.git"

git fetch upstream
git switch gh-pages


if [ "${GITHUB_REF##*/}" = develop ]; then
rm -r develop
mkdir -p develop/doc
cp ../index.html develop/
cp ../doc/index.html develop/doc
cp -a ../doc/html develop/doc/
else
rm index.html
rm -r html
cp ../doc/index.html .
cp -r ../doc/html .
fi


git add .

# Commit the new version.
git commit -m "Deploy to GitHub Pages: ${SHA}"

# Now that we're all set up, we can push.
git push -q upstream HEAD:gh-pages
17 changes: 17 additions & 0 deletions .github/actions/setup-boost/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Setup-Boost'
description: 'Downloads and sets up the necessary dependencies of Boost'
runs:
using: composite
steps:
- run: |
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/gil
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" gil
./bootstrap.sh
./b2 -d0 headers
shell: bash
17 changes: 17 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Docs-Build
on:
push:
branches:
- master
- develop

jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/docs-prerequisites
- uses: ./.github/actions/setup-boost
- uses: ./.github/actions/generate-publish-doc
with:
github_token: ${{ secrets.GIL_TEST_TOKEN }}

0 comments on commit 0778069

Please sign in to comment.