Skip to content

Commit

Permalink
Refac/docs configurable build cmd and node version (#83)
Browse files Browse the repository at this point in the history
pages refractor
  • Loading branch information
simonhir authored Dec 13, 2024
1 parent c403022 commit ae85c28
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
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
- 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

0 comments on commit ae85c28

Please sign in to comment.