From 24de2b848a8843f9674dbeab69bf6417c2baefbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Sat, 17 Aug 2024 18:48:13 +0200 Subject: [PATCH] chore: change CR layout (#259) --- .github/pull_request_template.md | 16 ++++++++++++++++ .github/workflows/cr-comment.yml | 19 +++++++++++++++++++ .github/workflows/cr.yml | 20 ++++++++++++++++++++ .github/workflows/publish-commit.yml | 28 ---------------------------- 4 files changed, 55 insertions(+), 28 deletions(-) create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/cr-comment.yml create mode 100644 .github/workflows/cr.yml delete mode 100644 .github/workflows/publish-commit.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..f8cd3d5 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,16 @@ +### Description + + + +### Linked Issues + + + +### Additional Context + + + +--- + +> [!TIP] +> The author of this PR can publish a _preview release_ by commenting `/publish` below. diff --git a/.github/workflows/cr-comment.yml b/.github/workflows/cr-comment.yml new file mode 100644 index 0000000..d6b8179 --- /dev/null +++ b/.github/workflows/cr-comment.yml @@ -0,0 +1,19 @@ +name: Add continuous release label + +on: + issue_comment: + types: [created] + +permissions: + pull-requests: write + +jobs: + label: + if: ${{ github.event.issue.pull_request && (github.event.comment.user.id == github.event.issue.user.id || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR') && startsWith(github.event.comment.body, '/publish') }} + runs-on: ubuntu-latest + + steps: + - uses: actions-ecosystem/action-add-labels@v1 + with: + labels: cr-tracked + github_token: ${{ secrets.CR_PAT }} diff --git a/.github/workflows/cr.yml b/.github/workflows/cr.yml new file mode 100644 index 0000000..b1e18d1 --- /dev/null +++ b/.github/workflows/cr.yml @@ -0,0 +1,20 @@ +name: CR + +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') }} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4.0.0 + - run: pnpm install + - run: pnpm prepack + - run: pnpx pkg-pr-new publish --compact --no-template --pnpm diff --git a/.github/workflows/publish-commit.yml b/.github/workflows/publish-commit.yml deleted file mode 100644 index 9659d02..0000000 --- a/.github/workflows/publish-commit.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Publish Any Commit - -on: - pull_request: - push: - branches: - - main - tags: - - '!**' - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install pnpm - uses: pnpm/action-setup@v4.0.0 - - - name: Install dependencies - run: pnpm install - - - name: Build - run: pnpm prepack - - - run: pnpm dlx pkg-pr-new publish --compact --pnpm