Skip to content

Merge pull request #19 from elbeno/add-readme #19

Merge pull request #19 from elbeno/add-readme

Merge pull request #19 from elbeno/add-readme #19

name: Publish GitHub Pages
on:
workflow_dispatch:
push:
branches: [ main ]
env:
DEBIAN_FRONTEND: noninteractive
jobs:
configure:
name: Configure Github Pages Publishing
runs-on: intel-ubuntu-22.04
outputs:
enable_publish: ${{ steps.check.outputs.isfork == 'NO' }}
steps:
- id: check
name: Check if Fork
run: |
if [ "${{ github.repository_owner }}" = "intel" ]; then
echo "This is the main repository, **enabling publishing**" >> "$GITHUB_STEP_SUMMARY"
echo "isfork=NO" >> "$GITHUB_OUTPUT"
else
echo "This is a fork, **disabling publishing**" >> "$GITHUB_STEP_SUMMARY"
echo "isfork=YES" >> "$GITHUB_OUTPUT"
fi
build:
needs: configure
name: Build Documentation
runs-on: intel-ubuntu-22.04
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install asciidoctor
run: |
sudo apt update
sudo apt install -y asciidoctor
sudo gem install asciidoctor asciidoctor-diagram rouge
- name: Build documentation
run: |
mkdir -p ./generated-html
asciidoctor -r asciidoctor-diagram docs/index.adoc -D ./generated-html
if [ -e docs/static ]; then cp -rf docs/static ./generated-html; fi
touch ./generated-html/.nojekyll
ls -la ./generated-html
cat ./generated-html/index.html
- name: Setup github pages
if: needs.configure.outputs.enable_publish == 'true'
uses: actions/configure-pages@v3
- name: Upload artifacts
uses: actions/upload-pages-artifact@v2
with:
path: ./generated-html
deploy:
needs: [configure, build]
if: needs.configure.outputs.enable_publish == 'true'
name: Deploy Documentation
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: $${{ steps.deployment.outputs.page_url }}
runs-on: intel-ubuntu-22.04
steps:
- name: Deploy to github pages
id: deployment
uses: actions/deploy-pages@v2