From 6595b29e32e3fd4084126c51ccc00e213560a88d Mon Sep 17 00:00:00 2001 From: Tuomas Rossi Date: Fri, 22 Nov 2024 14:46:20 +0200 Subject: [PATCH] Add CI job for pages --- .github/workflows/pages-html.yml | 25 +++++++++++++ .github/workflows/pages-pdf.yml | 17 +++++++++ .github/workflows/pages.yml | 62 ++++++++++++++++++++++++++++++++ about.yml | 3 ++ 4 files changed, 107 insertions(+) create mode 100644 .github/workflows/pages-html.yml create mode 100644 .github/workflows/pages-pdf.yml create mode 100644 .github/workflows/pages.yml create mode 100644 about.yml diff --git a/.github/workflows/pages-html.yml b/.github/workflows/pages-html.yml new file mode 100644 index 0000000..6db3d0a --- /dev/null +++ b/.github/workflows/pages-html.yml @@ -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 diff --git a/.github/workflows/pages-pdf.yml b/.github/workflows/pages-pdf.yml new file mode 100644 index 0000000..9244020 --- /dev/null +++ b/.github/workflows/pages-pdf.yml @@ -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 diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..8230bae --- /dev/null +++ b/.github/workflows/pages.yml @@ -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 diff --git a/about.yml b/about.yml new file mode 100644 index 0000000..f0b9fb7 --- /dev/null +++ b/about.yml @@ -0,0 +1,3 @@ +# This file is used in the generation of the web page +title: High-Level GPU Programming +slidesdir: docs