Skip to content

Commit

Permalink
add an alternative workflow to support copying of resources to docs/
Browse files Browse the repository at this point in the history
  • Loading branch information
mskopp committed Apr 17, 2024
1 parent 66c5a07 commit 1ea41b8
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/pages-generate-with-file-copy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Deploy static content from /docs to GitHub Pages, without checkout of the repository

on: # yamllint disable-line rule:truthy
workflow_call:

# 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:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Generate Pages content
run: |
cd ${{ github.workspace }}
mkdir -p build
cp -r docs build/
# at his point, "build/docs" contains folders
# index.md, examples (from docs)
# _layouts, assets (also from docs, should be from a template dir)
- name: Checkout blueprints
uses: actions/checkout@v4
with:
repository: riege/github-pages-build
sparse-checkout: pages-layout
path: _github-pages-build

- name: Apply blueprints
run: |
# Example when this is invoked from a repo playground-mskopp2:
# github.workspace = /home/runner/work/playground-mskopp2/playground-mskopp2
# it contains the checked out repository playground-mskopp2
# plus the contant of riege/github-pages-build
# limited to root folder files plus sub directlry pages-layout
# witin the folder named _github-pages-build
# So ${{ github.workspace }}/_github-pages-build/pages-layout
# contains the _layouts and assets folder.
#
cd ${{ github.workspace }}
mkdir -p build/docs
cp -r _github-pages-build/pages-layout/* build/docs
cp -r docs/* build/docs
### mkdir -p build/docs/schemas
### cp -r src/main/resources/schemas/* build/docs/schemas/
# at his point, "build/docs" contains folders
# index.md, examples (from docs)
# _layouts, assets (also from docs, should be from a template dir)
### schemas (content = src/main/resources/schemas/*)
- name: Setup Pages
uses: actions/configure-pages@v5

- name: Build HTML from pages .md and .html
uses: actions/jekyll-build-pages@v1
with:
source: build/docs
destination: build/pages

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: build/pages

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 1ea41b8

Please sign in to comment.