diff --git a/README.ko.md b/README.ko.md new file mode 100644 index 0000000..e9926ce --- /dev/null +++ b/README.ko.md @@ -0,0 +1,21 @@ +# @NaverPayDev/changeset-actions + +> [See English README](./README.md) + +- changeset 기반의 다양한 액션을 모아놓은 레포입니다. +- 해당 레포는 모노레포 구조로 여러 액션을 포함하며, 필요한 액션만 선택하여 사용하실 수 있습니다. +- 사용법은 하단 액션 목록의 각 액션별 리드미를 참고해주세요. + +## 관리 중인 액션 목록 + +### [detect add](./detect-add/README.ko.md) + +PR의 변경점을 파악하여 `.changeset` 하위에 변경된 파일에 대한 정보를 기재할 수 있도록 유도하는 action + +### [canary](./canary-publish/README.ko.md) + +`.changeset` 하위 변경된 패키지들의 안전성을 테스트하기 위해 canary 버전으로 배포를 도와주는 action + +### [publish](./publish/README.ko.md) + +`.changeset` 하위에 변경된 패키지들을 배포하고 자동으로 CHANGELOG 를 작성해주는 action diff --git a/README.md b/README.md index c627ea4..abce6dc 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,21 @@ # @NaverPayDev/changeset-actions -- changeset 기반의 다양한 액션을 모아놓은 레포입니다. -- 해당 레포는 모노레포 구조로 여러 액션을 포함하며, 필요한 액션만 선택하여 사용하실 수 있습니다. -- 사용법은 하단 액션 목록의 각 액션별 리드미를 참고해주세요. +> [한글 README 보기](./README.ko.md) -## 관리 중인 액션 목록 +- A repository containing various actions based on changesets. +- This repository follows a monorepo structure and includes multiple actions, allowing you to use only the actions you need. +- For usage instructions, please refer to the README of each action listed below. -### detect add +## Managed Action List -PR의 변경점을 파악하여 `.changeset` 하위에 변경된 파일에 대한 정보를 기재할 수 있도록 유도하는 action +### [detect add](./detect-add/README.md) -### canary +An action that detects changes in a pull request and guides users to document the changes in the `.changeset` directory. -`.changeset` 하위 변경된 패키지들의 안전성을 테스트하기 위해 canary 버전으로 배포를 도와주는 action +### [canary](./canary-publish/README.md) -### publish +An action that helps deploy canary versions of packages under the `.changeset` directory to test their stability. -`.changeset` 하위에 변경된 패키지들을 배포하고 자동으로 CHANGELOG 를 작성해주는 action +### [publish](./publish/README.md) + +An action that publishes the packages under the `.changeset` directory and automatically generates a CHANGELOG. diff --git a/canary-publish/README.ko.md b/canary-publish/README.ko.md new file mode 100644 index 0000000..d6a2d6d --- /dev/null +++ b/canary-publish/README.ko.md @@ -0,0 +1,56 @@ +# changesets-canary-publish + +## 설명 + +- changeset을 이용한 패키지 배포 플로우를 사용할 때, 해당 PR의 변경점을 파악하여 `.changeset` 하위 변경된 패키지들을 Canary 배포할 수 action 입니다. + +## 사용 방법 + +- 프로젝트 root의 `.github/workflows` 경로에 아래와 같이 `.yaml` 파일을 작성합니다. + +```yaml +# 기호에 맞게 변경해주세요 +name: changeset canary publish + +on: + issue_comment: + types: + - created + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + canary: + if: ${{ github.event.issue.pull_request && (github.event.comment.body == 'canary-publish' || github.event.comment.body == '/canary-publish')}} + runs-on: ubuntu-latest + steps: + - name: Get PR branch name + id: get_branch + run: | + PR=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" ${{ github.event.issue.pull_request.url }}) + echo "::set-output name=branch::$(echo $PR | jq -r '.head.ref')" + + - name: Checkout Repo + uses: actions/checkout@v3 + with: + ref: ${{ steps.get_branch.outputs.branch }} + + - name: Install Dependencies + run: pnpm install --frozen-lockfile + + - name: Canary Publish + uses: NaverPayDev/changeset-actions/canary-publish@main + with: + github_token: ${{ secrets.GITHUB_TOKEN }} # 필요하면 user의 PAT을 넣어주세요. + npm_tag: canary # npm 배포 시 달아줄 태그는 무엇으로 할지적어주세요 + npm_token: ${{ secrets.NPM_TOKEN }} # npm 배포시 필요한 publish token 을 넣어주세요 + publish_script: pnpm run deploy:canary # canary 배포 실행 script 를 넣어주세요 + packages_dir: packages # 변경을 탐지할 패키지들의 폴더명을 추가해주세요. (default: packages,share) + excludes: ".turbo,.github" # 변경감지를 제외하고싶은 파일 또는 폴더 경로 +``` + +## 실행 결과 + +![example](./src/assets/example.png) +![example2](./src/assets/example2.png) +![example3](./src/assets/example3.png) diff --git a/canary-publish/README.md b/canary-publish/README.md index d12bed4..e4d9a77 100644 --- a/canary-publish/README.md +++ b/canary-publish/README.md @@ -1,15 +1,15 @@ # changesets-canary-publish -## 설명 +## Description -- changeset을 이용한 패키지 배포 플로우를 사용할 때, 해당 PR의 변경점을 파악하여 `.changeset` 하위 변경된 패키지들을 Canary 배포할 수 action 입니다. +This action allows Canary deployment of modified packages under the `.changeset` directory when using a package deployment flow based on changesets. It identifies changes in the pull request and deploys the updated packages. -## 사용 방법 +## Usage -- 프로젝트 root의 `.github/workflows` 경로에 아래와 같이 `.yaml` 파일을 작성합니다. +Create a `.yaml` file in the `.github/workflows` directory at the root of your project as shown below: ```yaml -# 기호에 맞게 변경해주세요 +# Adjust according to your needs name: changeset canary publish on: @@ -39,17 +39,17 @@ jobs: run: pnpm install --frozen-lockfile - name: Canary Publish - uses: NaverPayDev/changeset-actions/actions/canary-publish@main + uses: NaverPayDev/changeset-actions/canary-publish@main with: - github_token: ${{ secrets.GITHUB_TOKEN }} # 필요하면 user의 PAT을 넣어주세요. - npm_tag: canary # npm 배포 시 달아줄 태그는 무엇으로 할지적어주세요 - npm_token: ${{ secrets.NPM_TOKEN }} # npm 배포시 필요한 publish token 을 넣어주세요 - publish_script: pnpm run deploy:canary # canary 배포 실행 script 를 넣어주세요 - packages_dir: packages # 변경을 탐지할 패키지들의 폴더명을 추가해주세요. (default: packages,share) - excludes: ".turbo,.github" # 변경감지를 제외하고싶은 파일 또는 폴더 경로 + github_token: ${{ secrets.GITHUB_TOKEN }} # Add user PAT if necessary + npm_tag: canary # Specify the npm tag to use for deployment + npm_token: ${{ secrets.NPM_TOKEN }} # Provide the token required for npm publishing + publish_script: pnpm run deploy:canary # Script to execute Canary deployment + packages_dir: packages # Directory of packages to detect changes (default: packages,share) + excludes: ".turbo,.github" # Files or directories to exclude from change detection ``` -## 실행 결과 +## Execution Results ![example](./src/assets/example.png) ![example2](./src/assets/example2.png) diff --git a/detect-add/action.yml b/detect-add/action.yml index 887aa9e..7bc40b0 100644 --- a/detect-add/action.yml +++ b/detect-add/action.yml @@ -27,6 +27,6 @@ inputs: required: false default: ".github,.changeset" language: - description: "detect add comment의 언어 설정 (en, kr 중 하나를 설정해주세요.)" + description: "detect add comment의 언어 설정 (en, ko 중 하나를 설정해주세요.)" required: false default: "en" diff --git a/detect-add/dist/index.js b/detect-add/dist/index.js index ce63efe..33c9379 100644 --- a/detect-add/dist/index.js +++ b/detect-add/dist/index.js @@ -33843,9 +33843,9 @@ function main() { const githubToken = core.getInput('github_token'); const octokit = github.getOctokit(githubToken); const language = core.getInput('language') || 'en'; - const isKoreanLanguage = language === 'kr'; - if (!['en', 'kr'].includes(language)) { - throw new Error(`An unsupported language value has been provided. Please use either \`en\` or \`kr\`. (Current value: ${language})`); + const isKoreanLanguage = language === 'ko'; + if (!['en', 'ko'].includes(language)) { + throw new Error(`An unsupported language value has been provided. Please use either \`en\` or \`ko\`. (Current value: ${language})`); } const commonParams = { owner, repo, issue_number: pullNumber }; /** diff --git a/detect-add/src/index.ts b/detect-add/src/index.ts index 79fbc21..169d938 100644 --- a/detect-add/src/index.ts +++ b/detect-add/src/index.ts @@ -25,11 +25,11 @@ async function main() { const octokit = github.getOctokit(githubToken) const language = core.getInput('language') || 'en' - const isKoreanLanguage = language === 'kr' + const isKoreanLanguage = language === 'ko' - if (!['en', 'kr'].includes(language)) { + if (!['en', 'ko'].includes(language)) { throw new Error( - `An unsupported language value has been provided. Please use either \`en\` or \`kr\`. (Current value: ${language})`, + `An unsupported language value has been provided. Please use either \`en\` or \`ko\`. (Current value: ${language})`, ) } diff --git a/publish/README.ko.md b/publish/README.ko.md new file mode 100644 index 0000000..c9e2663 --- /dev/null +++ b/publish/README.ko.md @@ -0,0 +1,49 @@ +# changesets-publish + +## 설명 + +- changeset을 이용한 패키지 배포 플로우를 사용할 때, 해당 PR의 변경점을 파악하여 `.changeset` 하위에 변경된 패키지들을 배포하는 action 입니다. +- .changeset 하위에 변경사항이 기록된 markdown 있다면 `changeset-release/main` 브랜치를 생성하고 markdown 파일이 없다면 publish 를 수행합니다. + +## 사용 방법 + +- 프로젝트 root의 `.github/workflows` 경로에 아래와 같이 `.yaml` 파일을 작성합니다. + +```yaml +# 기호에 맞게 변경해주세요 +name: changeset-publish + +on: + push: + branches: + - main + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + detectAdd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} + - uses: NaverPayDev/changeset-actions/publish@main + with: + github_token: ${{ secrets.GITHUB_TOKEN }} # 필요하면 user의 PAT을 넣어주세요. + npm_token: ${{ secrets.NPM_TOKEN }} # npm 배포시 필요한 publish token 을 넣어주세요 + publish_script: pnpm run deploy # 배포 실행 script 를 넣어주세요 + git_username: npay-fe-bot # 버전업 pr 생성시 설정할 github username 을 넣어주세요 + git_email: npay.fe.bot@navercorp.com # 버전업 pr 생성시 설정할 github email 을 넣어주세요 + pr_title: 🚀 version changed packages # 버전업 pr 생성시 설정할 pr 타이틀 넣어주세요 + commit_message: 📦 bump changed packages version # 버전업 pr 생성시 설정할 commit 메시지를 넣어주세요 + create_github_release_tag: true # release tag 생성여부를 넣어주세요 + formatting_script: pnpm run markdownlint:fix # 생성되는 md 파일의 formatting이 필요하다면 추가해주세요 +``` + +## 실행 결과 + +![example](./src/assets/pr.png) +![example](./src/assets/example.png) +![example](./src/assets/example2.png) +![example](./src/assets/example3.png) +![example](./src/assets/example4.png) diff --git a/publish/README.md b/publish/README.md index fc44927..a08a5c1 100644 --- a/publish/README.md +++ b/publish/README.md @@ -1,16 +1,15 @@ # changesets-publish -## 설명 +## Description -- changeset을 이용한 패키지 배포 플로우를 사용할 때, 해당 PR의 변경점을 파악하여 `.changeset` 하위에 변경된 패키지들을 배포하는 action 입니다. -- .changeset 하위에 변경사항이 기록된 markdown 있다면 `changeset-release/main` 브랜치를 생성하고 markdown 파일이 없다면 publish 를 수행합니다. +This action identifies changes in a pull request and deploys modified packages under the `.changeset` directory when using a changeset-based package deployment flow. If there are markdown files recording changes under `.changeset`, it creates a `changeset-release/main` branch. If no markdown files are present, it performs the publish operation. -## 사용 방법 +## Usage -- 프로젝트 root의 `.github/workflows` 경로에 아래와 같이 `.yaml` 파일을 작성합니다. +Create a `.yaml` file in the `.github/workflows` directory at the root of your project as shown below: ```yaml -# 기호에 맞게 변경해주세요 +# Adjust according to your needs name: changeset-publish on: @@ -29,18 +28,18 @@ jobs: ref: ${{ github.head_ref }} - uses: NaverPayDev/changeset-actions/actions/publish@main with: - github_token: ${{ secrets.GITHUB_TOKEN }} # 필요하면 user의 PAT을 넣어주세요. - npm_token: ${{ secrets.NPM_TOKEN }} # npm 배포시 필요한 publish token 을 넣어주세요 - publish_script: pnpm run deploy # 배포 실행 script 를 넣어주세요 - git_username: npay-fe-bot # 버전업 pr 생성시 설정할 github username 을 넣어주세요 - git_email: npay.fe.bot@navercorp.com # 버전업 pr 생성시 설정할 github email 을 넣어주세요 - pr_title: 🚀 version changed packages # 버전업 pr 생성시 설정할 pr 타이틀 넣어주세요 - commit_message: 📦 bump changed packages version # 버전업 pr 생성시 설정할 commit 메시지를 넣어주세요 - create_github_release_tag: true # release tag 생성여부를 넣어주세요 - formatting_script: pnpm run markdownlint:fix # 생성되는 md 파일의 formatting이 필요하다면 추가해주세요 + github_token: ${{ secrets.GITHUB_TOKEN }} # Add user PAT if necessary + npm_token: ${{ secrets.NPM_TOKEN }} # Token required for npm publishing + publish_script: pnpm run deploy # Script to execute the deployment + git_username: npay-fe-bot # GitHub username for version bump PR creation + git_email: npay.fe.bot@navercorp.com # GitHub email for version bump PR creation + pr_title: 🚀 version changed packages # PR title for version bump + commit_message: 📦 bump changed packages version # Commit message for version bump + create_github_release_tag: true # Whether to create a release tag + formatting_script: pnpm run markdownlint:fix # Add if formatting the generated markdown files is required ``` -## 실행 결과 +## Execution Results ![example](./src/assets/pr.png) ![example](./src/assets/example.png)