From e7c1e81692b5bc69ba4d63393a779fa5854980c8 Mon Sep 17 00:00:00 2001 From: BOSUNG BAEK Date: Wed, 10 Jul 2024 08:10:56 +0900 Subject: [PATCH] chore: Split PR creation and release into separate workflows --- .../{release.yml => create-review-pr.yml} | 8 ++-- .github/workflows/release-on-merge.yml | 45 +++++++++++++++++++ 2 files changed, 49 insertions(+), 4 deletions(-) rename .github/workflows/{release.yml => create-review-pr.yml} (93%) create mode 100644 .github/workflows/release-on-merge.yml diff --git a/.github/workflows/release.yml b/.github/workflows/create-review-pr.yml similarity index 93% rename from .github/workflows/release.yml rename to .github/workflows/create-review-pr.yml index 2b3f033..ff8aadb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/create-review-pr.yml @@ -1,4 +1,4 @@ -name: Release +name: Create and Review PR on: push: @@ -6,8 +6,8 @@ on: - main jobs: - release: - name: Release + create_pr: + name: Create PR runs-on: ubuntu-latest steps: - name: Checkout code @@ -71,7 +71,7 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, pull_number: prNumber, - reviewers: ['bo-like-chicken'] // replace with actual GitHub usernames + reviewers: ['reviewer1', 'reviewer2'] // replace with actual GitHub usernames }); } else { throw new Error("No open pull request found for branch 'update-version'"); diff --git a/.github/workflows/release-on-merge.yml b/.github/workflows/release-on-merge.yml new file mode 100644 index 0000000..1571a32 --- /dev/null +++ b/.github/workflows/release-on-merge.yml @@ -0,0 +1,45 @@ +name: Release + +on: + pull_request: + types: [closed] + branches: + - main + +jobs: + release: + if: github.event.pull_request.merged == true + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "20" + + - name: Install jq + run: sudo apt-get install -y jq + + - name: Install pnpm + run: | + npm install -g pnpm + pnpm config set store-dir ~/.pnpm-store + + - name: Cache pnpm store + uses: actions/cache@v3 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + + - name: Build and Publish + run: | + # Your build and publish commands here + echo "Building and publishing the package"