Skip to content

Commit

Permalink
Fix gh-pages SRG mapping index page generation and deployment.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggbecker committed Apr 13, 2022
1 parent 9454862 commit 79efde3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 35 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/srg-mapping-table.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ jobs:
with:
name: srg-mapping-rhel9.html
path: ${{ env.PAGES_DIR }}/srg-mapping-rhel9.html
- name: Generate HTML pages
run: utils/generate_html_index_srg_mapping.sh $PAGES_DIR "rhel9" # add more products to this list to generate their index
shell: bash
- name: Deploy
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@v4.2.3
with:
branch: gh-pages # The branch the action should deploy to.
folder: ${{ env.PAGES_DIR }} # The folder the action should deploy.
target-folder: srg_mapping
clean: no
clean: false
51 changes: 17 additions & 34 deletions utils/generate_html_pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,35 @@ fi

PAGES_DIR=$1

mkdir $PAGES_DIR
mkdir -p $PAGES_DIR
STATS_DIR=$PAGES_DIR/statistics
mkdir $STATS_DIR
mkdir -p $STATS_DIR
touch $STATS_DIR/index.html
echo "<html>" > $STATS_DIR/index.html
echo "<header>" >> index.html
echo "<h1>Statistics</h1>" >> index.html
echo "</header>" >> index.html
echo "<head>" >> $STATS_DIR/index.html
echo "<title>Statistics</title>" >> $STATS_DIR/index.html
echo "</head>" >> $STATS_DIR/index.html
echo "<h1>Statistics</h1>" >> $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)" | python3 | sed -s "s/'//g; s/,//g; s/\[//g; s/\]//g")
for product in $products
do
if [ -d build/$product ]; then
echo "<h4>Product: ${product}</h4>" >> $STATS_DIR/index.html
echo "<ul>" >> $STATS_DIR/index.html
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=\"$product/product-statistics/statistics.html\">Statistics for product: ${product}</a></li>" >> $STATS_DIR/index.html
echo "<li><a href=\"$product/product-statistics/statistics.html\">Product Statistics</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=\"$product/profile-statistics/statistics.html\">Profile statistics for product: ${product}</a></li>" >> $STATS_DIR/index.html
echo "<li><a href=\"$product/profile-statistics/statistics.html\">Profile statistics</a></li>" >> $STATS_DIR/index.html
fi
echo "</ul>" >> $STATS_DIR/index.html
fi
done
echo "</ul>" >> $STATS_DIR/index.html
echo "</body>" >> $STATS_DIR/index.html
echo "</html>" >> $STATS_DIR/index.html

Expand All @@ -60,9 +62,10 @@ fi
pushd build/tables
touch index.html
echo "<html>" > index.html
echo "<header>" >> index.html
echo "<head>" >> index.html
echo "<title>Mapping Tables</title>" >> index.html
echo "</head>" >> index.html
echo "<h1>Mapping Tables</h1>" >> index.html
echo "</header>" >> index.html
echo "<body>" >> index.html
echo "<ul>" >> index.html
for table in table-*.html
Expand All @@ -74,33 +77,13 @@ echo "</body>" >> index.html
echo "</html>" >> index.html
popd

# Generate SRG Mapping Tables
mkdir -p $PAGES_DIR/srg_mapping
pushd $PAGES_DIR/srg_mapping
touch index.html
echo "<html>" > index.html
echo "<header>" >> index.html
echo "<h1>SRG Mapping Tables</h1>" >> index.html
echo "</header>" >> index.html
echo "<body>" >> index.html
echo "<ul>" >> index.html
srg_products="rhel9" # space separated list of products
for product in $srg_products
do
echo "<li><a href=\"srg-mapping-${product}.html\">srg-mapping-${product}.html</a></li>" >> index.html
echo "<li><a href=\"srg-mapping-${product}.xlsx\">srg-mapping-${product}.xlsx</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 "<head>" >> index.html
echo "<title>Available Artifacts</title>" >> index.html
echo "</head>" >> 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
Expand Down

0 comments on commit 79efde3

Please sign in to comment.