From 017ed56a8a1f06f2c9f8aa6cd56bd4ba5a8610b6 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 19 Jul 2024 11:18:40 +0530 Subject: [PATCH] ci: split continuous release workflow to separate file (#4065) --- .github/workflows/ci.yml | 59 -------------------------------------- .github/workflows/cr.yml | 27 +++++++++++++++++ .github/workflows/test.yml | 49 +++++++++++++++++++++++++++++++ README.md | 2 +- 4 files changed, 77 insertions(+), 60 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/cr.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 48614b18..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: CI - -env: - NODE_OPTIONS: --max-old-space-size=6144 - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' - VITEST_SEGFAULT_RETRY: 3 - -on: - push: - branches: [main] - pull_request: - branches: [main] - types: [opened, synchronize, reopened, labeled, ready_for_review] - workflow_dispatch: - -permissions: {} - -concurrency: - group: ${{ github.workflow }}-${{ github.event.number || github.sha }} - cancel-in-progress: true - -jobs: - test: - if: github.event.action != 'labeled' || github.event.label.name == 'cr-tracked' - runs-on: ubuntu-latest - - strategy: - matrix: - node_version: [18, 20, 22] - exclude: - - node_version: ${{ (github.event.action == 'labeled' || github.event.action == 'ready_for_review') && 18 }} - - node_version: ${{ (github.event.action == 'labeled' || github.event.action == 'ready_for_review') && 20 }} - - node_version: ${{ (github.event.action == 'labeled' || github.event.action == 'ready_for_review') && (!contains(github.event.pull_request.labels.*.name, 'cr-tracked') || contains(github.event.pull_request.labels.*.name, 'spam') || contains(github.event.pull_request.labels.*.name, 'invalid')) && 22 }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install pnpm - uses: pnpm/action-setup@v3 - - - name: Set node version to ${{ matrix.node_version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node_version }} - cache: pnpm - - - name: Install deps - run: pnpm install - - - name: Install Playwright - run: pnpm playwright install chromium - - - name: Check - run: pnpm check - - - name: Publish preview - if: matrix.node_version == 22 && github.event_name == 'pull_request' && github.event.action != 'reopened' && !github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'cr-tracked') && !contains(github.event.pull_request.labels.*.name, 'spam') && !contains(github.event.pull_request.labels.*.name, 'invalid') - run: pnpx pkg-pr-new publish --compact --no-template --pnpm diff --git a/.github/workflows/cr.yml b/.github/workflows/cr.yml new file mode 100644 index 00000000..84c5a043 --- /dev/null +++ b/.github/workflows/cr.yml @@ -0,0 +1,27 @@ +name: CR + +env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' + +on: + pull_request: + branches: [main] + types: [opened, synchronize, labeled, ready_for_review] + +permissions: {} + +jobs: + release: + if: ${{ !github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'cr-tracked') && !contains(github.event.pull_request.labels.*.name, 'spam') && !contains(github.event.pull_request.labels.*.name, 'invalid') }} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v3 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + - run: pnpm install + - run: pnpm build + - run: npx pkg-pr-new publish --compact --no-template --pnpm diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..4d4e59be --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,49 @@ +name: Test + +env: + NODE_OPTIONS: --max-old-space-size=6144 + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' + VITEST_SEGFAULT_RETRY: 3 + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node_version: [18, 20, 22] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v3 + + - name: Set node version to ${{ matrix.node_version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node_version }} + cache: pnpm + + - name: Install deps + run: pnpm install + + - name: Install Playwright + run: pnpm playwright install chromium + + - name: Check + run: pnpm check diff --git a/README.md b/README.md index 978d4cc8..2e70a766 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # VitePress 📝💨 -[![test](https://github.com/vuejs/vitepress/workflows/CI/badge.svg)](https://github.com/vuejs/vitepress/actions) +[![test](https://github.com/vuejs/vitepress/workflows/Test/badge.svg)](https://github.com/vuejs/vitepress/actions) [![npm](https://img.shields.io/npm/v/vitepress)](https://www.npmjs.com/package/vitepress) [![chat](https://img.shields.io/badge/chat-discord-blue?logo=discord)](https://chat.vuejs.org)