Skip to content

Commit a4eb69f

Browse files
committed
ci: adds initial CI/CD pipeline for preview
1 parent 7c45a1d commit a4eb69f

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

Diff for: .github/workflows/deploy-preview.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Deploy a Preview Site
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: "latest"
16+
- run: npm install -g pnpm
17+
- run: pnpm install
18+
- run: sed -i "s|<name>|${GITHUB_HEAD_REF}|g" nuxt.config.ts
19+
- run: pnpm run generate
20+
- run: |
21+
mkdir -p dist/branches/${{ github.head_ref }}
22+
mv .output/public/* dist/branches/${{ github.head_ref }} || exit 0
23+
- uses: actions/upload-pages-artifact@v3
24+
with:
25+
name: "Project Documentation - Branch (${{ github.head_ref }})"
26+
path: "dist"
27+
deploy:
28+
needs: build
29+
permissions:
30+
pages: write
31+
id-token: write
32+
environment:
33+
name: github-pages
34+
url: ${{ steps.deployment.outputs.page_url }}
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Deploy to GitHub Pages
38+
id: deployment
39+
uses: actions/deploy-pages@v4
40+
with:
41+
artifact_name: "Project Documentation - Branch (${{ github.head_ref }})"

Diff for: nuxt.config.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export default defineNuxtConfig({
55
compatibilityDate: "2024-04-03",
66
css: ["~/assets/css/main.postcss"],
77
devtools: { enabled: true },
8+
ssr: false,
9+
rootDir: "/docs",
810
modules: [
911
"nuxt-lucide-icons",
1012
"@nuxt/content",
@@ -26,4 +28,4 @@ export default defineNuxtConfig({
2628
linkExactActiveClass: "active",
2729
},
2830
},
29-
});
31+
});

0 commit comments

Comments
 (0)