03.1.Git Doc - yojulab/learn_DevOps GitHub Wiki
λ³Έ λ¬Έμλ Git μ»€λ° λ©μμ§λ₯Ό λΆμνμ¬ CHANGELOG.md λλ DEVELOPMENT_DOC.mdμ κ°μ κ°λ° λ¬Έμλ₯Ό μλμΌλ‘ μμ±νκ³ κ΄λ¦¬νλ λ°©λ².
κ°λ° μμ°μ±μ λμ΄κΈ° μν΄μλ λ³κ²½ μ¬νμ λ¬Έμννλ κ³Όμ μ΄ νμμ μ λλ€. νμ§λ§ μλμΌλ‘ λ¬Έμλ₯Ό μμ±νλ κ²μ λ²κ±°λ‘κ³ μ€μκ° λ°μνκΈ° μ½μ΅λλ€.
ν΄κ²°μ± : Git μ»€λ° λ©μμ§λ₯Ό ꡬ쑰ννκ³ , μ΄λ₯Ό κΈ°λ°μΌλ‘ λ¬Έμλ₯Ό μλ μμ±νλ λꡬλ₯Ό λμ ν©λλ€.
- μλ: Rustλ‘ μμ±λμ΄ λ§€μ° λΉ λ¦ λλ€.
-
μ μ°μ±:
cliff.tomlνμΌμ ν΅ν΄ μΆλ ₯ νμμ μλ²½νκ² μ»€μ€ν°λ§μ΄μ§ν μ μμ΅λλ€. - λ²μ©μ±: GitHub Actionsμ κ°μ CI/CD λꡬμ μ½κ² ν΅ν©λ©λλ€.
μλ μμ±μ μν΄μλ μ»€λ° λ©μμ§κ° μΌμ ν κ·μΉμ λ°λΌμΌ ν©λλ€. κ°μ₯ λ리 μ°μ΄λ κ·μΉμ Conventional Commitsμ λλ€.
기본 ꡬ쑰:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
μμ£Ό μ¬μ©νλ Type:
-
feat: μλ‘μ΄ κΈ°λ₯ μΆκ° -
fix: λ²κ·Έ μμ -
update: μ½λ λ³κ²½ λλ μ μ§λ³΄μ (μ¬μ©μ μ μ) -
docs: λ¬Έμ μμ -
style: μ½λ ν¬λ§·ν , μΈλ―Έμ½λ‘ λλ½ λ± (μ½λ λ³κ²½ μμ) -
refactor: μ½λ 리ν©ν λ§ -
test: ν μ€νΈ μ½λ μΆκ°/μμ
λ¨κ³ 1: cliff.toml μ€μ
νλ‘μ νΈ λ£¨νΈμ cliff.toml νμΌμ μμ±νμ¬ λ¬Έμμ μ€νμΌμ μ μν©λλ€.
[changelog]
header = "# Development Documentation\n"
body = """
{% if version %}## [{{ version }}] - {{ timestamp | date(format='%Y-%m-%d') }}{% else %}## [Unreleased]{% endif %}
{% for group, commits in commits | group_by(attribute='group') %}
### {{ group }}
{% for commit in commits %}
- **[{{ commit.author.timestamp | date(format="%Y-%m-%d") }}]** {{ commit.message }} (by {{ commit.author.name }})
{% endfor %}
{% endfor %}
"""
[git]
conventional_commits = true
commit_parsers = [
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Fixes" },
{ message = "^update", group = "Updates" },
# ... κΈ°ν μ€μ
].github/workflows/changelog.yml νμΌμ μμ±νμ¬ μλνλ₯Ό μνν©λλ€.
name: Generate Changelog
on:
push:
branches: [master, main]
jobs:
changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # λͺ¨λ μ»€λ° νμ€ν 리λ₯Ό κ°μ ΈμμΌ ν¨
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
env:
OUTPUT: DEVELOPMENT_DOC.md # κ²°κ³Όκ° μ μ₯λ νμΌλͺ
- name: Commit and push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add DEVELOPMENT_DOC.md
git commit -m "docs: update DEVELOPMENT_DOC.md [skip ci]" || echo "No changes"
git push-
μ»€λ° λ©μμ§ μμ± μ μ£Όμμ¬ν:
feat:,fix:μ λμ¬λ₯Ό μ격ν μ§ν΅λλ€. -
λ‘컬 ν
μ€νΈ: GitHub Actionsμ μ¬λ¦¬κΈ° μ λ‘컬μ
git-cliffλ₯Ό μ€μΉνμ¬git cliff -o DEVELOPMENT_DOC.mdλͺ λ Ήμ΄λ‘ 미리 νμΈν΄ λ³Ό μ μμ΅λλ€. -
νκ·Έ νμ©:
git tag -a v1.0.0 -m "Release v1.0.0"μgit push origin v1.0.0μ κ°μ΄ νκ·Έλ₯Ό μμ±νλ©΄ λ²μ λ³λ‘ μ 리λ λ¬Έμλ₯Ό μ»μ μ μμ΅λλ€. μ΄λ νκ·Έ μ΄λ¦μvλ‘ μμν΄μΌ ν©λλ€.
Git λ©μμ§ κΈ°λ°μ λ¬Έμ μλνλ **"μ½λμ λ¬Έμμ λκΈ°ν"**λ₯Ό 보μ₯ν©λλ€. μ΄λ₯Ό ν΅ν΄ κ°λ°μλ μ½λ μμ±μλ§ μ§μ€ν μ μμΌλ©°, νλ‘μ νΈμ νμ€ν 리λ₯Ό ν¬λͺ νκ² κ΄λ¦¬ν μ μμ΅λλ€.
λ³Έ λ¬Έμλ Git μ»€λ° λ©μμ§λ₯Ό λΆμνμ¬ CHANGELOG.md λλ DEVELOPMENT_DOC.mdμ κ°μ κ°λ° λ¬Έμλ₯Ό μλμΌλ‘ μμ±νκ³ κ΄λ¦¬νλ λ°©λ²μ λν κ°μ μλ£μ
λλ€.
κ°λ° μμ°μ±μ λμ΄κΈ° μν΄μλ λ³κ²½ μ¬νμ λ¬Έμννλ κ³Όμ μ΄ νμμ μ λλ€. νμ§λ§ μλμΌλ‘ λ¬Έμλ₯Ό μμ±νλ κ²μ λ²κ±°λ‘κ³ μ€μκ° λ°μνκΈ° μ½μ΅λλ€.
ν΄κ²°μ± : Git μ»€λ° λ©μμ§λ₯Ό ꡬ쑰ννκ³ , μ΄λ₯Ό κΈ°λ°μΌλ‘ λ¬Έμλ₯Ό μλ μμ±νλ λꡬλ₯Ό λμ ν©λλ€.
- μλ: Rustλ‘ μμ±λμ΄ λ§€μ° λΉ λ¦ λλ€.
-
μ μ°μ±:
cliff.tomlνμΌμ ν΅ν΄ μΆλ ₯ νμμ μλ²½νκ² μ»€μ€ν°λ§μ΄μ§ν μ μμ΅λλ€. - λ²μ©μ±: GitHub Actionsμ κ°μ CI/CD λꡬμ μ½κ² ν΅ν©λ©λλ€.
μλ μμ±μ μν΄μλ μ»€λ° λ©μμ§κ° μΌμ ν κ·μΉμ λ°λΌμΌ ν©λλ€. κ°μ₯ λ리 μ°μ΄λ κ·μΉμ Conventional Commitsμ λλ€.
기본 ꡬ쑰:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
μμ£Ό μ¬μ©νλ Type:
-
feat: μλ‘μ΄ κΈ°λ₯ μΆκ° -
fix: λ²κ·Έ μμ -
update: μ½λ λ³κ²½ λλ μ μ§λ³΄μ (μ¬μ©μ μ μ) -
docs: λ¬Έμ μμ -
style: μ½λ ν¬λ§·ν , μΈλ―Έμ½λ‘ λλ½ λ± (μ½λ λ³κ²½ μμ) -
refactor: μ½λ 리ν©ν λ§ -
test: ν μ€νΈ μ½λ μΆκ°/μμ
νλ‘μ νΈ λ£¨νΈμ cliff.toml νμΌμ μμ±νμ¬ λ¬Έμμ μ€νμΌμ μ μν©λλ€.
[changelog]
header = "# Development Documentation\n"
body = """
{% if version %}## [{{ version }}] - {{ timestamp | date(format='%Y-%m-%d') }}{% else %}## [Unreleased]{% endif %}
{% for group, commits in commits | group_by(attribute='group') %}
### {{ group }}
{% for commit in commits %}
- **[{{ commit.author.timestamp | date(format="%Y-%m-%d") }}]** {{ commit.message }} (by {{ commit.author.name }})
{% endfor %}
{% endfor %}
"""
[git]
conventional_commits = true
commit_parsers = [
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Fixes" },
{ message = "^update", group = "Updates" },
# ... κΈ°ν μ€μ
].github/workflows/changelog.yml νμΌμ μμ±νμ¬ μλνλ₯Ό μνν©λλ€.
name: Generate Changelog
on:
push:
branches: [master, main]
jobs:
changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # λͺ¨λ μ»€λ° νμ€ν 리λ₯Ό κ°μ ΈμμΌ ν¨
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
env:
OUTPUT: DEVELOPMENT_DOC.md # κ²°κ³Όκ° μ μ₯λ νμΌλͺ
- name: Commit and push changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add DEVELOPMENT_DOC.md
git commit -m "docs: update DEVELOPMENT_DOC.md [skip ci]" || echo "No changes"
git push-
μ»€λ° λ©μμ§ μμ± μ μ£Όμμ¬ν:
feat:,fix:μ λμ¬λ₯Ό μ격ν μ§ν΅λλ€. -
λ‘컬 ν
μ€νΈ: GitHub Actionsμ μ¬λ¦¬κΈ° μ λ‘컬μ
git-cliffλ₯Ό μ€μΉνμ¬git cliff -o DEVELOPMENT_DOC.mdλͺ λ Ήμ΄λ‘ 미리 νμΈν΄ λ³Ό μ μμ΅λλ€. -
νκ·Έ νμ©:
git tag -a v1.0.0 -m "Release v1.0.0"μgit push origin v1.0.0μ κ°μ΄ νκ·Έλ₯Ό μμ±νλ©΄ λ²μ λ³λ‘ μ 리λ λ¬Έμλ₯Ό μ»μ μ μμ΅λλ€. μ΄λ νκ·Έ μ΄λ¦μvλ‘ μμν΄μΌ ν©λλ€.