diff --git a/.github/workflows/doc-preview.yml b/.github/workflows/doc-preview.yml new file mode 100644 index 0000000..101f621 --- /dev/null +++ b/.github/workflows/doc-preview.yml @@ -0,0 +1,51 @@ +name: Documentation (Preview) + +on: + pull_request: + branches: [main] + paths: + - docs/** + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + name: Deploy + permissions: + contents: read + deployments: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: pnpm/action-setup@v4 + with: + version: latest + + - uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: pnpm + + - name: Install & build + working-directory: docs + run: | + pnpm i + pnpm build + + - name: Deploy + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: pages deploy ./docs/build --project-name=configarr-preview + # Optional: Enable this if you want to have GitHub Deployments triggered + #gitHubToken: ${{ secrets.GITHUB_TOKEN }} + + - name: Comment PR + uses: thollander/actions-comment-pull-request@v3 + with: + message: | + Doc preview deployed to: ${{ steps.deploy.outputs.deployment-url }} + comment-tag: docs-preview