From b55145c0b7554d53c310f5c823089da22595148c Mon Sep 17 00:00:00 2001 From: Clay McLeod Date: Sat, 12 Oct 2024 13:07:06 -0500 Subject: [PATCH] ci: adds initial CI/CD pipeline for preview --- .github/workflows/deploy-preview.yml | 41 ++++++++++++++++++++++++++++ nuxt.config.ts | 6 ++-- 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/deploy-preview.yml diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml new file mode 100644 index 0000000..7883425 --- /dev/null +++ b/.github/workflows/deploy-preview.yml @@ -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" diff --git a/nuxt.config.ts b/nuxt.config.ts index f0010a7..604ab46 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -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", @@ -15,7 +18,6 @@ export default defineNuxtConfig({ "@nuxt/image", ], content: { - documentDriven: true, markdown: { remarkPlugins: { "remark-gfm": remarkGfm }, rehypePlugins: [], @@ -26,4 +28,4 @@ export default defineNuxtConfig({ linkExactActiveClass: "active", }, }, -}); \ No newline at end of file +});