diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..7282a6155b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + workflow_dispatch: + pull_request: + types: [opened, edited, reopened, closed, synchronize] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + cache: npm + - name: Install dependencies + run: npx ci + - name: Build docusaurus artifacts + env: + GH_PR_NUMBER: ${{ github.event.pull_request.number }} + run: npm run build -- --locale en --config ./docusaurus.config.ci.js + - name: PR Number + run: echo "PR-${{ github.event.pull_request.number }}" + - name: Deploy PR Preview + uses: rossjrw/pr-preview-action@v1 + with: + token: ${{ secrets.GH_TOKEN }} + preview-branch: gh-pages + source-dir: ./build/ + umbrella-dir: pr-preview \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 155919467f..ee6d8ac577 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -34,7 +34,7 @@ jobs: - name: Setup Pages uses: actions/configure-pages@v4 - name: Use Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: cache: npm - name: Install dependencies diff --git a/docusaurus.config.ci.js b/docusaurus.config.ci.js new file mode 100644 index 0000000000..6f90699e85 --- /dev/null +++ b/docusaurus.config.ci.js @@ -0,0 +1,10 @@ +import config from './docusaurus.config'; + +/** @type {import('@docusaurus/types').Config} */ +const prConfig = { + ...config, + noIndex: true, + baseUrl: `${config.baseUrl}/pr-preview/pr-${process.env.GH_PR_NUMBER}` +}; + +export default prConfig;