From 20e3f365c63fe34cb5f51d40a3a3792914648e77 Mon Sep 17 00:00:00 2001 From: young-do Date: Fri, 23 Aug 2024 21:41:41 +0900 Subject: [PATCH] =?UTF-8?q?npm=20version=EC=9D=84=20=ED=99=9C=EC=9A=A9?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=20=EC=8B=9C?= =?UTF-8?q?=EB=8F=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/bump-up.yml | 41 ++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/.github/workflows/bump-up.yml b/.github/workflows/bump-up.yml index 6233e2c..2d27112 100644 --- a/.github/workflows/bump-up.yml +++ b/.github/workflows/bump-up.yml @@ -1,4 +1,3 @@ -# @see: https://github.com/anothrNick/github-tag-action name: Bump version on: push: @@ -7,18 +6,34 @@ on: - feature/auto-tagging jobs: - build: + update-version: runs-on: ubuntu-latest - permissions: - contents: write steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '0' + - name: Checkout code + uses: actions/checkout@v4 + + - name: Determine version type + id: get_version_type + run: | + last_commit_message=$(git log -1 --pretty=%B) + echo "Last commit message: $last_commit_message" + + if [[ "$last_commit_message" == *"#major"* ]]; then + echo "version_type=major" >> $GITHUB_ENV + elif [[ "$last_commit_message" == *"#minor"* ]]; then + echo "version_type=minor" >> $GITHUB_ENV + else + echo "No specific version bump keyword found. Defaulting to patch." + echo "version_type=patch" >> $GITHUB_ENV + fi - - name: Bump version and push tag - uses: anothrNick/github-tag-action@v1 # Don't use @master or @v1 unless you're happy to test the latest version - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # if you don't want to set write permissions use a PAT token - WITH_V: true - DRY_RUN: true + - name: Bump version + run: | + git config --local user.name "github-actions[bot]" + git config --local user.email "github-actions[bot]@users.noreply.github.com" + npm version ${{ env.version_type }} + + - name: Push changes + uses: ad-m/github-push-action@master + with: + tags: true