Skip to content

Merge pull request #12 from intel/dependabot/github_actions/actions/d… #12

Merge pull request #12 from intel/dependabot/github_actions/actions/d…

Merge pull request #12 from intel/dependabot/github_actions/actions/d… #12

name: Publish GitHub Pages
permissions: read-all
on:
workflow_dispatch:
push:
branches: [ main ]
env:
DEBIAN_FRONTEND: noninteractive
jobs:
configure:
name: Configure Github Pages Publishing
runs-on: ${{ github.repository_owner == 'intel' && '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: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-22.04
steps:
- name: Checkout source
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Node.js
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: 18
- name: Install Mermaid
run: |
sudo npm install -g @mermaid-js/[email protected]
node /usr/local/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer/install.js
- 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
- name: Setup github pages
if: needs.configure.outputs.enable_publish == 'true'
uses: actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d # v4.0.0
- name: Upload artifacts
uses: actions/upload-pages-artifact@0252fc4ba7626f0298f0cf00902a25c6afc77fa8 # v3.0.0
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: ${{ github.repository_owner == 'intel' && 'intel-' || '' }}ubuntu-22.04
steps:
- name: Deploy to github pages
id: deployment
uses: actions/deploy-pages@decdde0ac072f6dcbe43649d82d9c635fff5b4e4 # v4.0.4