Skip to content

Commit

Permalink
ci: adds initial CI/CD pipeline for preview
Browse files Browse the repository at this point in the history
  • Loading branch information
claymcleod committed Oct 12, 2024
1 parent 7c45a1d commit b55145c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy a Preview Site

on:
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "latest"
- run: npm install -g pnpm
- run: pnpm install
- run: sed -i "s|/docs|/docs/branches/${GITHUB_HEAD_REF}|g" nuxt.config.ts; cat nuxt.config.ts
- run: pnpm nuxt build --preset github_pages
- run: |
mkdir -p dist/branches/${{ github.head_ref }}
mv .output/public/* dist/branches/${{ github.head_ref }} || exit 0
- uses: actions/upload-pages-artifact@v3
with:
name: "Project Documentation"
path: "dist"
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: "Project Documentation"
6 changes: 4 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export default defineNuxtConfig({
compatibilityDate: "2024-04-03",
css: ["~/assets/css/main.postcss"],
devtools: { enabled: true },
app: {
baseURL: "/docs",
},
modules: [
"nuxt-lucide-icons",
"@nuxt/content",
Expand All @@ -15,7 +18,6 @@ export default defineNuxtConfig({
"@nuxt/image",
],
content: {
documentDriven: true,
markdown: {
remarkPlugins: { "remark-gfm": remarkGfm },
rehypePlugins: [],
Expand All @@ -26,4 +28,4 @@ export default defineNuxtConfig({
linkExactActiveClass: "active",
},
},
});
});

0 comments on commit b55145c

Please sign in to comment.