From d78c83bf72066658cb2db517d741b6e2a42970fa Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Fri, 19 Jul 2024 02:05:53 +0530 Subject: [PATCH] ci: setup pkg.pr.new (#4062) --- .github/pull_request_template.md | 16 ++++++++++++++++ .github/workflows/{test.yml => ci.yml} | 14 ++++++++++++-- .github/workflows/cr-comment.yml | 18 ++++++++++++++++++ README.md | 2 +- 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 .github/pull_request_template.md rename .github/workflows/{test.yml => ci.yml} (55%) create mode 100644 .github/workflows/cr-comment.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..433228c0 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,16 @@ +### Description + + + +### Linked Issues + + + +### Additional context + + + +--- + +> [!TIP] +> The owner of this PR can publish a _preview release_ by commenting `/publish` in this PR. diff --git a/.github/workflows/test.yml b/.github/workflows/ci.yml similarity index 55% rename from .github/workflows/test.yml rename to .github/workflows/ci.yml index 2d69b469..abfdad6a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Test +name: CI env: NODE_OPTIONS: --max-old-space-size=6144 @@ -10,20 +10,26 @@ on: branches: [main] pull_request: branches: [main] - types: [opened, synchronize, reopened] + types: [opened, synchronize, reopened, labeled] 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' && 18 }} + - node_version: ${{ github.event.action == 'labeled' && 20 }} steps: - name: Checkout @@ -46,3 +52,7 @@ jobs: - 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 diff --git a/.github/workflows/cr-comment.yml b/.github/workflows/cr-comment.yml new file mode 100644 index 00000000..a1e21310 --- /dev/null +++ b/.github/workflows/cr-comment.yml @@ -0,0 +1,18 @@ +name: Add continuous release label + +on: + issue_comment: + types: [created] + +permissions: + issues: write + +jobs: + cr_comment: + if: github.event.issue.pull_request && (github.event.comment.user.id == github.event.issue.user.id || contains('OWNER,MEMBER,COLLABORATOR', github.event.comment.author_association)) && startsWith(github.event.comment.body, '/publish') + runs-on: ubuntu-latest + + steps: + - uses: actions-ecosystem/action-add-labels@v1 + with: + labels: cr-tracked diff --git a/README.md b/README.md index 2e70a766..978d4cc8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # VitePress 📝💨 -[![test](https://github.com/vuejs/vitepress/workflows/Test/badge.svg)](https://github.com/vuejs/vitepress/actions) +[![test](https://github.com/vuejs/vitepress/workflows/CI/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)