Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refac/docs configurable build cmd and node version #83

Merged
merged 12 commits into from
Dec 13, 2024
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# https://vitepress.dev/guide/deploy#github-pages
name: Deploy Pages
on:
workflow_call:
Expand All @@ -6,6 +7,18 @@ on:
required: false
default: "./docs"
type: string
node-version:
required: false
default: "22"
type: string
build-cmd:
required: false
default: "build"
type: string
dist-path:
required: false
default: "dist"
type: string

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
Expand All @@ -30,23 +43,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
fetch-depth: 0 # Required for vitepress lastUpdated
devtobi marked this conversation as resolved.
Show resolved Hide resolved
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm # or pnpm / yarn
node-version: ${{ inputs.node-version }}
cache: npm
cache-dependency-path: "${{ inputs.sub-path }}/package-lock.json"
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Install dependencies
run: npm ci # or pnpm install / yarn install / bun install
run: npm ci
- name: Build with VitePress
run: npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
run: npm run ${{ inputs.build-cmd }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ inputs.sub-path }}/docs/.vitepress/dist
path: ${{ inputs.sub-path }}/${{ inputs.dist-path }}

# Deployment job
deploy:
Expand Down
6 changes: 2 additions & 4 deletions workflow-templates/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Sample workflow for building and deploying a VitePress site to GitHub Pages
#
name: Deploy VitePress site to Pages
name: Deploy docs

on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
Expand All @@ -16,4 +14,4 @@ on:

jobs:
deploy-pages:
uses: it-at-m/.github/.github/workflows/reuseable-template-deploy-pages.yml@main
uses: it-at-m/.github/.github/workflows/deploy-pages.yml@main