Skip to content

Commit

Permalink
Add gh-pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggbecker committed Feb 1, 2022
1 parent c8b2d2d commit 3ad030e
Showing 1 changed file with 118 additions and 0 deletions.
118 changes: 118 additions & 0 deletions .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Github Pages
on:
push:
branches: [ 'master' ]
jobs:
publish:
name: Publish stats, tables and guides
runs-on: ubuntu-20.04
steps:
- name: Install Deps
uses: mstksg/get-package@master
with:
apt-get: cmake ninja-build libopenscap8 libxml2-utils expat xsltproc python3-jinja2 python3-yaml python3-setuptools ansible-lint python3-github bats python3-pytest python3-pytest-cov python3-pip
- name: Install deps python
run: pip3 install json2html
- name: Checkout
uses: actions/checkout@v2
- name: Build
run: cmake .. -G Ninja
working-directory: ./build
- name: Build page
run: ninja rhel8
working-directory: ./build
- name: Build page
run: ninja rhel8-html-stats rhel8-html-profile-stats -j2
working-directory: ./build
- name: Generate HTML pages
run: |-
PAGES_DIR=__pages
mkdir $PAGES_DIR
STATS_DIR=$PAGES_DIR/statistics
mkdir $STATS_DIR
touch $STATS_DIR/index.html
echo "<html>" > $STATS_DIR/index.html
echo "<body>" >> $STATS_DIR/index.html
echo "<ul>" >> $STATS_DIR/index.html
# get supported products
products=$(echo -e "import ssg.constants\nprint(ssg.constants.product_directories)" | python | sed -s "s/'//g; s/,//g; s/\[//g; s/\]//g")
echo "Supported products: $products"
for product in $products
do
if [ -d build/$product ]; then
mkdir -p $STATS_DIR/$product
if [ -f build/$product/product-statistics/statistics.html ]; then
cp -rf build/$product/product-statistics $STATS_DIR/$product/product-statistics
echo "<li><a href=\"statistics/$product/product-statistics/statistics.html\">Statistics for product: ${product}</a></li>" >> $STATS_DIR/index.html
fi
if [ -f build/$product/profile-statistics/statistics.html ]; then
cp -rf build/$product/profile-statistics $STATS_DIR/$product/profile-statistics
echo "<li><a href=\"statistics/$product/profile-statistics/statistics.html\">Profile statistics for product: ${product}</a></li>" >> $STATS_DIR/index.html
fi
fi
done
echo "</ul>" >> $STATS_DIR/index.html
echo "</body>" >> $STATS_DIR/index.html
echo "</html>" >> $STATS_DIR/index.html
pushd build/guides
touch index.html
echo "<html>" > index.html
echo "<header>" >> index.html
echo "<h1>Right Click to save the guide and open it locally</h1>" >> index.html
echo "</header>" >> index.html
echo "<body>" >> index.html
echo "<ul>" >> index.html
for guide in ssg-*.html
do
echo "<li><a href=\"${guide}\">${guide}</a></li>" >> index.html
done
echo "</ul>" >> index.html
echo "</body>" >> index.html
echo "</html>" >> index.html
popd
cp -rf build/guides $PAGES_DIR
pushd build/tables
touch index.html
echo "<html>" > index.html
echo "<header>" >> index.html
echo "<h1>Right Click to save the table and open it locally</h1>" >> index.html
echo "</header>" >> index.html
echo "<body>" >> index.html
echo "<ul>" >> index.html
for table in table-*.html
do
echo "<li><a href=\"${table}\"</a></li>" >> index.html
done
echo "</ul>" >> index.html
echo "</body>" >> index.html
echo "</html>" >> index.html
popd
pushd $PAGES_DIR
touch index.html
echo "<html>" > index.html
echo "<header>" >> index.html
echo "<h1>Available Artifacts</h1>" >> index.html
echo "</header>" >> index.html
echo "<body>" >> index.html
echo "<ul>" >> index.html
echo "<li><a href=\"statistics/index.html\">Statistics</a></li>" >> index.html
echo "<li><a href=\"guides/index.html\">Guides</a></li>" >> index.html
echo "<li><a href=\"tables/index.html\">Tables</a></li>" >> index.html
echo "</ul>" >> index.html
echo "</body>" >> index.html
echo "</html>" >> index.html
popd
cp -rf build/tables $PAGES_DIR
- name: Deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: __pages # The folder the action should deploy.

0 comments on commit 3ad030e

Please sign in to comment.