All about

github에서 repository를 관리하다보면 tag를 사용해서 버전관리를 하게 되는 경우가 있는데, 업데이트(merge)가 될때마다 수작업으로 tag를 생성하는 것은 매우 번거롭다.

 

많은 개발자들이 필요에 의해 github action을 통해서 자동으로 tag를 생성하는 기능인 auto tagging을 만들어서 배포하고 있다.

 

github action이 무엇인지는 잘 정리되어 있는 링크로 대신한다.

 

0. auto tagging을 하고 싶다면 repo의 모든 권한을 가지고 있어야 한다.

 

1. repository 페이지로 돌아와서 actions -> New workflow -> set up a workflow yourself -> 파일 편집창에 아래 repo의 usage를 그대로 복사 붙여넣기 한다. 이 외에도 본인에게 필요한(혹은 적절한) 기능을 제공하는 자동 태그 소프트웨어를 배포하는 repo가 있다면 그곳의 action code를 참조한다. 더 자세한 내용은 아래 코드블럭의 주석을 참고하자.

https://github.com/mathieudutour/github-tag-action

 

mathieudutour/github-tag-action

A Github Action to automatically bump and tag master, on merge, with the latest SemVer formatted version. Works on any platform. - mathieudutour/github-tag-action

github.com

name: Bump version
on:
  push:
    branches:
      - master # master branch로 push될 때 아래 action이 실행된다.
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Bump version and push tag
        id: tag_version
        uses: mathieudutour/github-tag-action@v5.5 # 가져다 쓸 auto tagging 프로그램
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }} # secrets.GITHUB_TOKEN 는 자동생성됨
      - name: Create a GitHub release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ steps.tag_version.outputs.new_tag }}
          release_name: Release ${{ steps.tag_version.outputs.new_tag }}
          body: ${{ steps.tag_version.outputs.changelog }}

공유하기

facebook twitter kakaoTalk kakaostory naver band
loading