From d59b24b3f3221f682b6025bb65735190f2cf3967 Mon Sep 17 00:00:00 2001 From: Eduard Marbach Date: Sat, 23 Nov 2024 12:51:54 +0100 Subject: [PATCH] ci: add doc previews --- .github/workflows/doc-preview.yml | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/doc-preview.yml diff --git a/.github/workflows/doc-preview.yml b/.github/workflows/doc-preview.yml new file mode 100644 index 0000000..95d771e --- /dev/null +++ b/.github/workflows/doc-preview.yml @@ -0,0 +1,56 @@ +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 + pull-requests: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Inject enhanced GitHub environment variables + uses: rlespinasse/github-slug-action@v5 + + - 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 + id: cloudflare-deploy + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: pages deploy ./docs/build --project-name=configarr-preview --branch=$GITHUB_REF_SLUG_URL + # 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.cloudflare-deploy.outputs.deployment-url }} + comment-tag: docs-preview