메이저 버전업 테스트 입니다~ #38
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: auto-tagging | |
#https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-describe.html | |
on: | |
pull_request: | |
branches: | |
# - master | |
- test** | |
types: | |
# - closed | |
- opened | |
- synchronize | |
# if: github.event.pull_request.merged == true | |
jobs: | |
auto-tagging: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: get latest tag | |
run: | | |
git fetch origin test/tagging:test/tagging | |
git checkout test/tagging | |
latest_tag_version=$(git tag --sort=-v:refname | head -n 1) | |
echo "latest tag version is $latest_tag_version" | |
echo "LATEST_TAG_VERSION=${latest_tag_version}" >> $GITHUB_ENV | |
- name: set default tag version | |
run: | | |
current_tag=$(echo $LATEST_TAG_VERSION | sed 's/v//') | |
echo "major=$(echo $current_tag | cut -d. -f1)" >> $GITHUB_ENV | |
echo "minor=$(echo $current_tag | cut -d. -f2)" >> $GITHUB_ENV | |
echo "patch=$(echo $current_tag | cut -d. -f3)" >> $GITHUB_ENV | |
- name: major version up | |
if: contains(github.event.pull_request.labels.*.name, 'major') | |
run: | | |
new_major=$((major + 1)) | |
echo "major=${new_major}" >> $GITHUB_ENV | |
echo "new major version is $new_major" | |
- name: minor version up | |
if: contains(github.event.pull_request.labels.*.name, 'minor') | |
run: | | |
new_minor=$((minor + 1)) | |
echo "minor=$new_minor" >> $GITHUB_ENV | |
echo "new minor version is $new_minor" | |
- name: patch version up | |
if: contains(github.event.pull_request.labels.*.name, 'patch') | |
run: | | |
new_patch=$((patch + 1)) | |
echo "patch=${new_patch}" >> $GITHUB_ENV | |
echo "new patch version is $new_patch" | |
- name: print all version | |
run: | | |
echo "update version is v$major.$minor.$patch" | |
echo "new_tag=v$major.$minor.$patch" >> $GITHUB_ENV | |
- name: original branch checkout | |
run: | | |
git fetch origin test/last_tag_test:test/last_tag_test | |
git checkout test/last_tag_test | |
- name: List all files in current directory | |
run: ls -alR . | |
# 두 버전이 같은 경우 (아무런 라벨이 없다면) 태그 만들지 않고 종료 | |
- name: validate new tag | |
run: | | |
chmod +x ./scripts/validate_version.sh | |
./scripts/validate_version.sh | |
- name: tagging | |
run: | | |
git tag $new_tag | |
git push origin $new_tag | |
- name: print current tag | |
run: git tag |