Skip to content

Commit

Permalink
Add CI job for pages
Browse files Browse the repository at this point in the history
  • Loading branch information
trossi committed Nov 22, 2024
1 parent a5c4e43 commit 6595b29
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/pages-html.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy HTML slides to Pages

on:
# Runs on pushes targeting the default branch
push:
branches:
- "main"
paths:
- "docs/**"
- ".github/workflows/pages.yml"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

jobs:
pages-html:
uses: ./.github/workflows/pages.yml
with:
include_pdf: false
17 changes: 17 additions & 0 deletions .github/workflows/pages-pdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Deploy HTML and PDF slides to Pages

on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

jobs:
pages-pdf:
uses: ./.github/workflows/pages.yml
with:
include_pdf: true
62 changes: 62 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Script based on examples in https://github.com/actions/starter-workflows/tree/main/pages
name: Deploy slides to Pages

on:
workflow_call:
inputs:
include_pdf:
required: true
type: boolean

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
timeout-minutes: 30
runs-on: ubuntu-latest
container:
image: ghcr.io/csc-training/slidefactory:3.1.0-beta.6
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Build slides
env:
INCLUDE_PDF: ${{ inputs.include_pdf }}
run: |
git config --global --add safe.directory $PWD
GIT_SHORT_SHA=$(git rev-parse --short $GITHUB_SHA)
GIT_DATE=$(git show -s --format=%ci $GITHUB_SHA)
ARGS=""
[[ "$INCLUDE_PDF" == "true" ]] && ARGS="--with-pdf"
slidefactory pages about.yml build --info_content "Updated for [$GIT_SHORT_SHA]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$GITHUB_SHA) ($GIT_DATE)" $ARGS
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./build

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 3 additions & 0 deletions about.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is used in the generation of the web page
title: High-Level GPU Programming
slidesdir: docs

0 comments on commit 6595b29

Please sign in to comment.