diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml new file mode 100644 index 00000000..7b25c922 --- /dev/null +++ b/.github/workflows/deploy-docs.yml @@ -0,0 +1,61 @@ +name: Deploy Docs + +on: + push: + branches: [docs/migrate-to-vitepress] // TODO: Change to `main` + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: pages + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Required to calculate lastUpdated + - uses: pnpm/action-setup@v3 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Navigate to correct directory + run: cd docs/ + - name: Install dependencies + run: pnpm ci + - name: Build with VitePress + run: pnpm docs:build + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs/.vitepress/dist + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: build + runs-on: ubuntu-latest + name: Deploy + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index daa59237..310a7dcb 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -6,6 +6,7 @@ export default defineConfig({ title: 'NuxtAuth', titleTemplate: ':title - by sidebase', description: 'The productive way to build fullstack Nuxt 3 applications.', + base: '/nuxt-auth/', // TODO: Change once we deploy to offical domain lang: 'en-US', appearance: 'dark', lastUpdated: true, @@ -26,5 +27,9 @@ export default defineConfig({ search: { provider: 'local', }, + editLink: { + pattern: 'https://github.com/sidebase/nuxt-auth/tree/main/docs/:path', + text: 'Edit this page on GitHub' + } }, })