본문 바로가기
OpenSource

Github changelogs

by egas 2021. 7. 18.

오늘은 Github에서  Conventional Commits 통해서 변경사항들을 추적하는데 도움을 주는 chagelogs에 대해 알아보자. 우리는 chagelogs를 통해 배포에 대한 변경점들을 쉽게 파악할 수 있다. 여러가지 changelogs 생성기들이 있지만 오늘은 우선 standard-version 에 대해서 알아볼 것이다.

 

설치

yarn add -D standard-version

 

package.json의 scripts에 release를 추가해준다.

  "scripts": {
    ...,
    "release": "standard-version"
  }

 

그리고 .versionrc 파일을 추가해준다. Conventional Commits의 형식에서 <타입>[적용 범위(선택 사항)]: <설명> 타입부분에 대하여 .versionrc 파일은 section으로 명시해서 분리해준다.

 

  • type: Conventional Commits 형식에서 type 부분.
  • section: CHANGELOG.md에서 분류될 type의 명시적인 제목이다.
  • hidden: LOG 생성시 반영 여부.

 

{
  "types": [
    {"type":"feat","section":"Features", "hidden": false},
    {"type":"fix","section":"Bug Fixes", "hidden": false},
    {"type":"test","section":"Tests", "hidden": true},
    {"type":"build","section":"Build System", "hidden": true},
    {"type":"chore", "section":"Others", "hidden": false },
    {"type":"docs", "section":"Docs", "hidden": false },
    {"type":"style", "section":"Styling", "hidden": false },
    {"type":"refactor", "section":"Code Refactoring", "hidden": false }
  ]
}

 

 

처음 release를 할 때는 --first-release를 붙여주어서 CHANGELOG.md와 release/tag를 만들어준다.

yarn release -- --first-release

 

내가 쓴 커밋 메세지 형식에 맞춰서 커밋을 분류하여 아래 파일을 자동으로 생성해준다.

 

그 이후에는 yarn release 명령어만 입력해도 알아서 반영하며 그 후 아래 명령어를 통해서 npm 배포와 release 적용을 할 수 있다.

git push --follow-tags origin master && npm publish

 

 

 

참고

https://github.com/conventional-changelog/standard-version

 

conventional-changelog/standard-version

:trophy: Automate versioning and CHANGELOG generation, with semver.org and conventionalcommits.org - conventional-changelog/standard-version

github.com

 

728x90

'OpenSource' 카테고리의 다른 글

ripgrep 소개  (0) 2021.07.30
gource 소개  (0) 2021.07.28
gh-pages 로 배포하기  (0) 2021.07.17
Github multiple authors  (0) 2021.07.17
gpg를 설정 해보자! (github verified)  (0) 2021.05.13

댓글