Skip to content

Merge pull request #18 from arup-group/GSA-7787-Sample-model-Steel-De… #33

Merge pull request #18 from arup-group/GSA-7787-Sample-model-Steel-De…

Merge pull request #18 from arup-group/GSA-7787-Sample-model-Steel-De… #33

# This is a basic workflow to help you get started with Actions
name: Make GitHub Pages Site
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a single command using the runners shell
- name: Run a one-line script
run: |
function writePages {
ignorefiles=( index.md README.md LICENSE )
hasDir=$([ $(find . -type d | wc -l) -gt 1 ] && echo true || echo false)
if [[ $hasDir == true ]]
then
directories=$(ls -d */)
title=$()
echo "" > index.md
for one in $directories
do
echo "- [$one]($one)" >> index.md
done
find * -maxdepth 0 -type f -print0 | while IFS= read -r -d $'\0' file; do
if ! [[ ${ignorefiles[*]} =~ "$file" ]]
then
echo "- [$file]($file)" >> index.md
fi
done
for directory in $directories
do
cd $directory
writePages
cd ../
done
else
echo "" > index.md
for one in *; do
if ! [[ ${ignorefiles[*]} =~ "$one" ]]
then
echo "- [$one]($one)" >> index.md
fi
done
fi
}
writePages
rsync -av --progress . public --exclude .git --exclude .github --exclude public
- name: Deploy to GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: public
fqdn: samples.oasys-software.com
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}