diff --git a/.github/workflows/build-examples.yml b/.github/workflows/build-examples.yml index 5342ad3f82bf..625797805093 100644 --- a/.github/workflows/build-examples.yml +++ b/.github/workflows/build-examples.yml @@ -29,10 +29,6 @@ jobs: concurrency: group: ${{ github.ref }}-build-examples cancel-in-progress: true - strategy: - matrix: - node-version: [18.x] - name: Create Example Chunks if: "${{ !github.event.pull_request.draft }}" @@ -58,15 +54,15 @@ jobs: args: [--ignore-scripts] - name: Fetch commits run: git fetch origin ${{ github.base_ref || 'master' }} --depth=1 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 18 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 18 cache: "pnpm" - name: Split Into Chunks id: chunkstep - run: CHUNKS=6 BASE_REF=${{ github.base_ref }} BUILD_ALL_EXAMPLES=${{ (contains(steps.pr-labels.outputs.labels, ' build-examples ') || github.event_name == 'schedule' ) && 'true' || 'false' }} node ./.github/workflows/build-example-chunks.js + run: CHUNKS=6 BASE_REF=${{ github.base_ref }} BUILD_ALL_EXAMPLES=${{ (contains(steps.pr-labels.outputs.labels, ' build-examples ') || github.event_name == 'schedule' ) && 'true' || 'false' }} node ./.github/workflows/scripts/build-example-chunks.js build-chunk-1: runs-on: ubuntu-latest @@ -91,10 +87,10 @@ jobs: with: version: 9 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 18 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 18 cache: "pnpm" - name: Install Dependencies @@ -110,7 +106,7 @@ jobs: run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)" - name: Run E2E Tests - run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_1 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-1-${{ github.run_attempt }} node ./.github/workflows/e2e-examples.js + run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_1 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-1-${{ github.run_attempt }} node ./.github/workflows/scripts/e2e-examples.js build-chunk-2: runs-on: ubuntu-latest @@ -135,10 +131,10 @@ jobs: with: version: 9 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 18 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 18 cache: "pnpm" - name: Install Dependencies @@ -154,7 +150,7 @@ jobs: run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)" - name: Run E2E Tests - run: REFINE_NO_TELEMETRY=true BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_2 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-2-${{ github.run_attempt }} node ./.github/workflows/e2e-examples.js + run: REFINE_NO_TELEMETRY=true BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_2 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-2-${{ github.run_attempt }} node ./.github/workflows/scripts/e2e-examples.js build-chunk-3: runs-on: ubuntu-latest @@ -179,10 +175,10 @@ jobs: with: version: 9 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 18 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 18 cache: "pnpm" - name: Install Dependencies @@ -198,7 +194,7 @@ jobs: run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)" - name: Run E2E Tests - run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_3 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-3-${{ github.run_attempt }} node ./.github/workflows/e2e-examples.js + run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_3 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-3-${{ github.run_attempt }} node ./.github/workflows/scripts/e2e-examples.js build-chunk-4: runs-on: ubuntu-latest @@ -223,10 +219,10 @@ jobs: with: version: 9 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 18 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 18 cache: "pnpm" - name: Install Dependencies @@ -242,7 +238,7 @@ jobs: run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)" - name: Run E2E Tests - run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_4 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-4-${{ github.run_attempt }}-4 node ./.github/workflows/e2e-examples.js + run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_4 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-4-${{ github.run_attempt }}-4 node ./.github/workflows/scripts/e2e-examples.js build-chunk-5: runs-on: ubuntu-latest @@ -267,10 +263,10 @@ jobs: with: version: 9 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 18 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 18 cache: "pnpm" - name: Install Dependencies @@ -286,7 +282,7 @@ jobs: run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)" - name: Run E2E Tests - run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_5 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-5-${{ github.run_attempt }} node ./.github/workflows/e2e-examples.js + run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_5 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-5-${{ github.run_attempt }} node ./.github/workflows/scripts/e2e-examples.js build-chunk-6: runs-on: ubuntu-latest @@ -311,10 +307,10 @@ jobs: with: version: 9 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 18 uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 18 cache: "pnpm" - name: Install Dependencies @@ -330,4 +326,4 @@ jobs: run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)" - name: Run E2E Tests - run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_6 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-6-${{ github.run_attempt }} node ./.github/workflows/e2e-examples.js + run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_6 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-6-${{ github.run_attempt }} node ./.github/workflows/scripts/e2e-examples.js diff --git a/.github/workflows/doc-checks.yml b/.github/workflows/doc-checks.yml deleted file mode 100644 index ddc1c540118c..000000000000 --- a/.github/workflows/doc-checks.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Documentation Spell Check -on: - push: - branches: - - master - paths: - - "documentation" - pull_request: - branches: - - master - paths: - - "documentation" - -jobs: - misspell: - concurrency: - group: ${{ github.ref }}-typos-lint - cancel-in-progress: true - name: Check spelling using typos - runs-on: ubuntu-latest - steps: - - name: Check out code. - uses: actions/checkout@v4 - - name: typos - id: check_for_typos - uses: crate-ci/typos@master - with: - config: ./typos.toml diff --git a/.github/workflows/pull-request-doc.yml b/.github/workflows/documentation.yml similarity index 59% rename from .github/workflows/pull-request-doc.yml rename to .github/workflows/documentation.yml index 77cc63c56d25..65b7be468a96 100644 --- a/.github/workflows/pull-request-doc.yml +++ b/.github/workflows/documentation.yml @@ -1,36 +1,40 @@ -name: PR Documentation [synchronize] +name: Documentation on: pull_request: - types: - - synchronize - - opened - - reopened paths: - "documentation/**" + jobs: - documentation: - if: github.repository_owner == 'refinedev' + typos: + name: Check spelling using typos runs-on: ubuntu-latest concurrency: - group: ${{ github.ref }}-pr-doc + group: docs-typos-${{ github.ref }} + cancel-in-progress: true + steps: + - name: Check out code. + uses: actions/checkout@v4 + - name: typos + id: check_for_typos + uses: crate-ci/typos@master + with: + config: ./typos.toml + deploy_documentation: + name: Documentation Deploy + runs-on: ubuntu-latest + concurrency: + group: docs-deploy-${{ github.ref }} cancel-in-progress: true - strategy: - matrix: - node-version: [18.x] - - name: Deploy Documentation Preview - steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v3 with: version: 9 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} - cache: "pnpm" + node-version: 18 + cache: pnpm - name: Add key to allow access to repository env: SSH_AUTH_SOCK: /tmp/ssh_agent.sock @@ -44,30 +48,41 @@ jobs: HostName github.com IdentityFile ~/.ssh/id_rsa EOT - - name: Install Package Dependencies + - name: Install & build dependencies + run: pnpm install + - name: Install dependencies (Docs) run: | + cd documentation pnpm install - - name: Install Doc Dependencies + - name: Release to GitHub Pages + if: github.ref == 'refs/heads/master' + env: + USE_SSH: true + GIT_USER: pankod-bot + NODE_ENV: production + NODE_OPTIONS: "--max_old_space_size=4096" run: | cd documentation - pnpm install + git config --global user.email "bot@pankod.com" + git config --global user.name "pankod-bot" + LIVE_PREVIEW_URL=https://next.live-previews.refine.dev/preview pnpm run deploy - name: Wait for Netlify Deploy (Live Previews) uses: probablyup/wait-for-netlify-action@3.2.0 id: waitForDeployment + if: github.ref != 'refs/heads/master' continue-on-error: true with: site_id: ${{ secrets.NETLIFY_PREVIEW_SITE_ID }} max_timeout: 1200 env: NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - - name: output test - run: | - echo ${{ steps.waitForDeployment.outputs.url }} - name: Build Documentation + if: github.ref != 'refs/heads/master' run: | cd documentation LIVE_PREVIEW_URL=${{ steps.waitForDeployment.outputs.url }}/preview pnpm build - name: Deploy to Netlify + if: github.ref != 'refs/heads/master' id: netlify-deploy uses: nwtgck/actions-netlify@v1.2 with: @@ -82,5 +97,5 @@ jobs: NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} timeout-minutes: 15 - name: Check Existing Links in Documentation - if: steps.netlify-deploy.outputs.deploy-url - run: DEPLOY_URL=${{ steps.netlify-deploy.outputs.deploy-url }} SITEMAP_URL=https://refine.dev/sitemap.xml node ./.github/workflows/check-existing-doc-links.js + if: ${{ github.ref != 'refs/heads/master' && steps.netlify-deploy.outputs.deploy-url }} + run: DEPLOY_URL=${{ steps.netlify-deploy.outputs.deploy-url }} SITEMAP_URL=https://refine.dev/sitemap.xml node ./.github/workflows/scripts/check-existing-doc-links.js diff --git a/.github/workflows/example-previews.yml b/.github/workflows/example-previews.yml index adcd47beb387..dbd0339f72a7 100644 --- a/.github/workflows/example-previews.yml +++ b/.github/workflows/example-previews.yml @@ -3,15 +3,122 @@ name: Deploy Example Previews on: issue_comment: types: [created] + pull_request: + types: + - opened + - synchronize + - reopened + - labeled + push: + branches: + - master + workflow_dispatch: + inputs: + example_name: + description: "Example name to deploy preview" + type: choice + required: true + options: + - finefoods-antd + - finefoods-client + - finefoods-material-ui + - app-crm + - pixels + - invoicer jobs: - deploy_example_preview: + changes: + runs-on: ubuntu-latest + # Required permissions + permissions: + pull-requests: read + # Set job outputs to values from filter step + outputs: + examples: ${{ steps.filter.outputs.changes }} + all_examples: ${{ steps.deploy-previews-label.outputs.all_examples || false }} + dispatch_example: ${{ join(inputs.example_name) || false }} + steps: + - name: Get PR labels + id: pr-labels + uses: joerick/pr-labels-action@v1.0.9 + # For pull requests it's not necessary to checkout the code + - name: 'Check deploy previews label' + id: deploy-previews-label + run: echo 'all_examples=["finefoods-antd", "finefoods-client", "finefoods-material-ui", "app-crm", "pixels", "invoicer"]' >> $GITHUB_OUTPUT + if: ${{ contains(steps.pr-labels.outputs.labels, ' deploy-previews ') }} + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + 'finefoods-antd': 'examples/finefoods-antd/**' + 'finefoods-client': 'examples/finefoods-client/**' + 'finefoods-material-ui': 'examples/finefoods-material-ui/**' + 'app-crm': 'examples/app-crm/**' + 'pixels': 'examples/pixels/**' + 'invoicer': 'examples/invoicer/**' + build_previews_matrix: + name: Build previews matrix + permissions: + pull-requests: read + issues: read + outputs: + matrix: ${{ steps.build_examples_matrix.outputs.EXAMPLES }} runs-on: ubuntu-latest if: ${{ contains(github.event.comment.body, '/deploy') }} steps: - - name: Set Example Name - id: set-example-name - run: echo "EXAMPLE_NAME=$(echo ${{ github.event.comment.body }} | cut -f 2 -d ' ')" >> $GITHUB_ENV + - uses: actions/checkout@v4 + - name: Build examples matrix + id: build_examples_matrix + run: COMMENT_BODY=${{ github.event.comment.body }} node ./.github/workflows/scripts/deploy-previews.js + + deploy_example_preview: + needs: build_previews_matrix + if: needs.build_previews_matrix.outputs.matrix != '[]' + permissions: + pull-requests: read + issues: read + strategy: + matrix: + example: ${{ fromJson(needs.build_previews_matrix.outputs.matrix) }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v3 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: "pnpm" + - name: Install Dependencies + run: pnpm install --ignore-scripts + - name: Build example + run: pnpm build --scope ${{ matrix.example.name }} + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v3.0 + with: + publish-dir: ${{ matrix.example.publish_dir }} + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: "Deploy from GitHub Actions [Comment]" + alias: deploy-preview-${{ matrix.example.name }}-${{ github.event.comment.node_id }} + enable-pull-request-comment: true + overwrites-pull-request-comment: true + github-deployment-environment: "deploy-preview-${{ matrix.example.name }}-${{ github.event.comment.node_id }}" + netlify-config-path: ${{ matrix.example.netlify_config_path }} + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + timeout-minutes: 10 + preview: + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.all_examples || needs.changes.outputs.examples != '[]' || needs.changes.outputs.dispatch_example }} + strategy: + fail-fast: false + max-parallel: 6 + matrix: + example: ${{ fromJSON(needs.changes.outputs.examples || needs.changes.outputs.all_examples || needs.changes.outputs.dispatch_example) }} + steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v3 with: @@ -23,20 +130,18 @@ jobs: - name: Install Dependencies run: pnpm install --ignore-scripts - name: Build example - run: pnpm build --scope ${{ env.EXAMPLE_NAME }} - - name: test path - run: ls -l ${{ format('./examples/{0}/{1}', env.EXAMPLE_NAME, contains(fromJson('["finefoods-client"]'), env.EXAMPLE_NAME) && '.next' || 'dist') }} + run: pnpm build --scope ${{ matrix.example }} - name: Deploy to Netlify - uses: nwtgck/actions-netlify@v1.2 + uses: nwtgck/actions-netlify@v3.0 with: - publish-dir: ${{ format('./examples/{0}/{1}', env.EXAMPLE_NAME, contains(fromJson('["finefoods-client"]'), env.EXAMPLE_NAME) && '.next' || 'dist') }} - github-token: ${{ secrets.PANKOD_BOT_TOKEN }} + publish-dir: ${{ format('./examples/{0}/{1}', matrix.example, contains(fromJson('["finefoods-client"]'), matrix.example) && '.next' || 'dist') }} + github-token: ${{ secrets.GITHUB_TOKEN }} deploy-message: "Deploy from GitHub Actions" - alias: deploy-preview-${{ env.EXAMPLE_NAME }}-${{ github.event.comment.node_id }} + alias: deploy-preview-${{ matrix.example }}-${{ github.event.number }} enable-pull-request-comment: false overwrites-pull-request-comment: false - github-deployment-environment: "deploy-preview-${{ env.EXAMPLE_NAME }}-${{ github.event.comment.node_id }}" - netlify-config-path: ./examples/${{ env.EXAMPLE_NAME }}/netlify.toml + github-deployment-environment: "deploy-preview-${{ matrix.example }}-${{ github.event.number }}" + netlify-config-path: ./examples/${{ matrix.example }}/netlify.toml env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} diff --git a/.github/workflows/deploy-live-previews.yml b/.github/workflows/live-previews.yml similarity index 100% rename from .github/workflows/deploy-live-previews.yml rename to .github/workflows/live-previews.yml diff --git a/.github/workflows/pull-request-previews.yml b/.github/workflows/pull-request-previews.yml deleted file mode 100644 index c58d5fe92f8a..000000000000 --- a/.github/workflows/pull-request-previews.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: PR Previews - -on: - pull_request: - types: - - synchronize - - opened - - reopened - paths: - - "packages/**" - - "examples/finefoods-antd/**" - - "examples/finefoods-material-ui/**" - - "examples/finefoods-client/**" - -jobs: - antd-fine-foods: - runs-on: ubuntu-latest - concurrency: - group: ${{ github.ref }}-pr-antd-fine-foods - cancel-in-progress: true - strategy: - matrix: - node-version: [18.x] - - name: Fine Foods Antd - - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v3 - with: - version: 9 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: "pnpm" - - name: Install Dependencies - run: | - pnpm install - pnpm build --scope finefoods-antd - - name: Deploy to Netlify - uses: nwtgck/actions-netlify@v1.2 - with: - publish-dir: "./examples/finefoods-antd/dist" - github-token: ${{ secrets.PANKOD_BOT_TOKEN }} - deploy-message: "Deploy from GitHub Actions" - alias: deploy-preview-antd-${{ github.event.number }} - enable-pull-request-comment: false - overwrites-pull-request-comment: false - github-deployment-environment: "deploy-preview-antd-${{ github.event.number }}" - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - timeout-minutes: 10 - mui-fine-foods: - runs-on: ubuntu-latest - concurrency: - group: ${{ github.ref }}-pr-mui-fine-foods - cancel-in-progress: true - strategy: - matrix: - node-version: [18.x] - - name: Fine Foods Material UI - - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v3 - with: - version: 9 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: "pnpm" - - uses: pnpm/action-setup@v3 - with: - version: 9 - - name: Install Dependencies - run: | - pnpm install - pnpm build --scope finefoods-material-ui - - name: Deploy to Netlify - uses: nwtgck/actions-netlify@v1.2 - with: - publish-dir: "./examples/finefoods-material-ui/dist" - github-token: ${{ secrets.PANKOD_BOT_TOKEN }} - deploy-message: "Deploy from GitHub Actions" - alias: deploy-preview-mui-${{ github.event.number }} - enable-pull-request-comment: false - overwrites-pull-request-comment: false - github-deployment-environment: "deploy-preview-mui-${{ github.event.number }}" - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - timeout-minutes: 10 diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 95abffea4fda..fde29f5a15f2 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -13,19 +13,15 @@ jobs: - uses: wagoid/commitlint-github-action@v5 lint: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.x] name: Lint steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v3 with: version: 9 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 18 cache: "pnpm" - name: Install Dependencies run: | @@ -40,19 +36,15 @@ jobs: concurrency: group: ${{ github.ref }}-pr-build cancel-in-progress: true - strategy: - matrix: - node-version: [18.x] name: Build & Test steps: - uses: actions/checkout@v4 - uses: pnpm/action-setup@v3 with: version: 9 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 18 cache: "pnpm" - name: Install & Build run: | @@ -66,7 +58,6 @@ jobs: - name: Are The Types Wrong run: | pnpm attw:all - tsdoc-check: runs-on: ubuntu-latest name: Check TSDoc Links diff --git a/.github/workflows/master-push.yml b/.github/workflows/release.yml similarity index 71% rename from .github/workflows/master-push.yml rename to .github/workflows/release.yml index e9557d7651cf..cb4c0a7a1dee 100644 --- a/.github/workflows/master-push.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: stable Release +name: Release on: push: @@ -11,10 +11,6 @@ jobs: concurrency: group: ${{ github.ref }}-stable-release cancel-in-progress: true - strategy: - matrix: - node-version: [18.x] - outputs: published: ${{ steps.changesets.outputs.published }} steps: @@ -28,10 +24,9 @@ jobs: - uses: pnpm/action-setup@v3 with: version: 9 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 18 cache: "pnpm" - name: Creating .npmrc run: | @@ -110,47 +105,3 @@ jobs: --set ingress.tls[0].hosts[0]=${{ env.domain }} \ env: domain: "next.live-previews.refine.dev" - documentation-gh: - runs-on: ubuntu-latest - concurrency: - group: ${{ github.ref }}-stable-documentation - cancel-in-progress: true - steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v3 - with: - version: 9 - - uses: actions/setup-node@v3 - with: - node-version: "18.x" - - name: Add key to allow access to repository - env: - SSH_AUTH_SOCK: /tmp/ssh_agent.sock - run: | - mkdir -p ~/.ssh - ssh-keyscan github.com >> ~/.ssh/known_hosts - echo "${{ secrets.GH_PAGES_DEPLOY }}" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - cat <> ~/.ssh/config - Host github.com - HostName github.com - IdentityFile ~/.ssh/id_rsa - EOT - - name: Build packages - env: - NODE_OPTIONS: "--max_old_space_size=4096" - run: | - pnpm install - cd documentation - pnpm install - - name: Release to GitHub Pages - env: - USE_SSH: true - GIT_USER: pankod-bot - NODE_ENV: production - NODE_OPTIONS: "--max_old_space_size=4096" - run: | - cd documentation - git config --global user.email "bot@pankod.com" - git config --global user.name "pankod-bot" - LIVE_PREVIEW_URL=https://next.live-previews.refine.dev/preview pnpm run deploy diff --git a/.github/workflows/build-example-chunks.js b/.github/workflows/scripts/build-example-chunks.js similarity index 99% rename from .github/workflows/build-example-chunks.js rename to .github/workflows/scripts/build-example-chunks.js index b5e8bf15403e..7c84302e98e7 100755 --- a/.github/workflows/build-example-chunks.js +++ b/.github/workflows/scripts/build-example-chunks.js @@ -148,6 +148,7 @@ for (let i = 0; i < examples.length; i += chunkSize) { // // Set outputs // + chunks.forEach((chunk, i) => { console.log(`::set-output name=CHUNK_${i + 1}::${chunk.join(",")}`); }); diff --git a/.github/workflows/check-existing-doc-links.js b/.github/workflows/scripts/check-existing-doc-links.js similarity index 100% rename from .github/workflows/check-existing-doc-links.js rename to .github/workflows/scripts/check-existing-doc-links.js diff --git a/.github/workflows/scripts/deploy-previews.js b/.github/workflows/scripts/deploy-previews.js new file mode 100644 index 000000000000..c897f65103e5 --- /dev/null +++ b/.github/workflows/scripts/deploy-previews.js @@ -0,0 +1,61 @@ +#!/usr/bin/env node + +const fs = require("fs"); + +const COMMENT_BODY = process.env.COMMENT_BODY || false; + +const setOutput = (output) => + console.log(`::set-output name=EXAMPLES::${output}`); + +const getPublishDir = (exampleName) => { + if (fs.existsSync(`./examples/${exampleName}/next-env.d.ts`)) + return "./.next"; + + if (fs.existsSync(`./examples/${exampleName}/remix.config.js`)) + return "./build"; + + return "./dist"; +}; + +const getNetlifyConfigPath = (exampleName) => { + const configPath = `./examples/${exampleName}/netlify.toml`; + + if (fs.existsSync(configPath)) return configPath; + + return ""; +}; + +const buildExamplesOutput = (comment) => { + if (!COMMENT_BODY) { + setOutput("[]"); + return; + } + + const re = /(?:\/deploy\s{1})((?:[\w-]*(?:,|, {1}| {1})?)*)(?:\n)?/g; + + const match = re.exec(comment); + + const examples = match?.[1] + ?.split(",") + .filter((m) => m.length > 1) + .map((e) => e.trim()) + .filter((e) => fs.existsSync(`./examples/${e}/package.json`)); + + if (!examples?.length) { + setOutput("[]"); + + return; + } + + const output = examples.map((e) => { + return { + name: e, + publish_dir: getPublishDir(e), + netlify_config_path: getNetlifyConfigPath(e), + }; + }); + + setOutput(JSON.stringify(output)); +}; + +buildExamplesOutput(COMMENT_BODY); diff --git a/.github/workflows/e2e-examples.js b/.github/workflows/scripts/e2e-examples.js similarity index 100% rename from .github/workflows/e2e-examples.js rename to .github/workflows/scripts/e2e-examples.js diff --git a/.github/workflows/store-deploy.yml b/.github/workflows/store-deploy.yml index 734566461f60..45b20d428f60 100644 --- a/.github/workflows/store-deploy.yml +++ b/.github/workflows/store-deploy.yml @@ -14,9 +14,6 @@ jobs: concurrency: group: ${{ github.ref }}-store-deploy cancel-in-progress: true - strategy: - matrix: - node-version: [18.x] steps: - uses: actions/checkout@v4 diff --git a/examples/finefoods-antd/netlify.toml b/examples/finefoods-antd/netlify.toml new file mode 100644 index 000000000000..b9e0f32e8651 --- /dev/null +++ b/examples/finefoods-antd/netlify.toml @@ -0,0 +1,4 @@ +[[redirects]] +from = "/*" +to = "/index.html" +status = 404 \ No newline at end of file diff --git a/examples/finefoods-client/netlify.toml b/examples/finefoods-client/netlify.toml new file mode 100644 index 000000000000..bc761666acb6 --- /dev/null +++ b/examples/finefoods-client/netlify.toml @@ -0,0 +1,2 @@ +[[plugins]] +package = "@netlify/plugin-nextjs" diff --git a/examples/finefoods-client/package.json b/examples/finefoods-client/package.json index e570d68ff611..a39926bf33d7 100644 --- a/examples/finefoods-client/package.json +++ b/examples/finefoods-client/package.json @@ -22,6 +22,7 @@ "react-dom": "^18.0.0" }, "devDependencies": { + "@netlify/plugin-nextjs": "5.2.2", "@types/node": "^18.16.2", "@types/react": "^18.0.0", "autoprefixer": "^10.4.1", diff --git a/examples/finefoods-material-ui/netlify.toml b/examples/finefoods-material-ui/netlify.toml new file mode 100644 index 000000000000..b9e0f32e8651 --- /dev/null +++ b/examples/finefoods-material-ui/netlify.toml @@ -0,0 +1,4 @@ +[[redirects]] +from = "/*" +to = "/index.html" +status = 404 \ No newline at end of file diff --git a/examples/invoicer/netlify.toml b/examples/invoicer/netlify.toml new file mode 100644 index 000000000000..b9e0f32e8651 --- /dev/null +++ b/examples/invoicer/netlify.toml @@ -0,0 +1,4 @@ +[[redirects]] +from = "/*" +to = "/index.html" +status = 404 \ No newline at end of file diff --git a/examples/pixels/netlify.toml b/examples/pixels/netlify.toml new file mode 100644 index 000000000000..b9e0f32e8651 --- /dev/null +++ b/examples/pixels/netlify.toml @@ -0,0 +1,4 @@ +[[redirects]] +from = "/*" +to = "/index.html" +status = 404 \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a16023b5c5f7..6521e817f02b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5855,6 +5855,9 @@ importers: specifier: ^18.0.0 version: 18.3.0(react@18.3.0) devDependencies: + '@netlify/plugin-nextjs': + specifier: 5.2.2 + version: 5.2.2 '@types/node': specifier: ^18.16.2 version: 18.19.31 @@ -34243,10 +34246,12 @@ packages: read-package-json@6.0.4: resolution: {integrity: sha512-AEtWXYfopBj2z5N5PbkAOeNHRPUg5q+Nen7QLxV8M2zJq1ym6/lCz3fYNTCXe19puu2d06jfHhrP7v/S2PtMMw==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + deprecated: This package is no longer supported. Please use @npmcli/package-json instead. read-package-json@7.0.0: resolution: {integrity: sha512-uL4Z10OKV4p6vbdvIXB+OzhInYtIozl/VxUBPgNkBuUi2DeRonnuspmaVAMcrkmfjKGNmRndyQAbE7/AmzGwFg==} engines: {node: ^16.14.0 || >=18.0.0} + deprecated: This package is no longer supported. Please use @npmcli/package-json instead. read-pkg-up@1.0.1: resolution: {integrity: sha512-WD9MTlNtI55IwYUS27iHh9tK3YoIVhxis8yKhLpTqWtml739uXc9NWTpxoHkfZf3+DkCCsXox94/VWZniuZm6A==}