Skip to content

Commit

Permalink
chore: bump version (major, minor, patch) 자동화 스크립트 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
toothlessdev committed Aug 25, 2024
1 parent 1754f72 commit b60a8d9
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 3 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/version-major.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Bump Version (Major)

on:
workflow_dispatch:

env:
NODE_VERSION: 22
NPM_REGISTRY: https://registry.npmjs.org/

jobs:
bump-version:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Code Checkout
uses: actions/checkout@v4

- name: SetUp Node
uses: actions/setup-node@v4
with:
node-version: ${{env.NODE_VERSION}}
registry-url: https://registry.npmjs.org/

- name: Get GitHub User Info
id: user_info
run: |
# GitHub API를 사용하여 트리거한 사용자의 이메일과 이름 가져오기
user_name="${{ github.actor }}"
user_email=$(curl -s https://api.github.com/users/${{ github.actor }} | jq -r '.email')
if [ -z "$user_email" ] || [ "$user_email" = "null" ]; then
user_email="${{ github.actor }}@users.noreply.github.com"
fi
echo "user_name=$user_name" >> $GITHUB_ENV
echo "user_email=$user_email" >> $GITHUB_ENV
- name: Bump Version (Major)
run: |
git config --global user.email "${{ env.user_email }}"
git config --global user.name "${{ env.user_name }}"
npm version major
git push origin main --tag
46 changes: 46 additions & 0 deletions .github/workflows/version-minor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Bump Version (Minor)

on:
workflow_dispatch:

env:
NODE_VERSION: 22
NPM_REGISTRY: https://registry.npmjs.org/

jobs:
bump-version:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Code Checkout
uses: actions/checkout@v4

- name: SetUp Node
uses: actions/setup-node@v4
with:
node-version: ${{env.NODE_VERSION}}
registry-url: https://registry.npmjs.org/

- name: Get GitHub User Info
id: user_info
run: |
# GitHub API를 사용하여 트리거한 사용자의 이메일과 이름 가져오기
user_name="${{ github.actor }}"
user_email=$(curl -s https://api.github.com/users/${{ github.actor }} | jq -r '.email')
if [ -z "$user_email" ] || [ "$user_email" = "null" ]; then
user_email="${{ github.actor }}@users.noreply.github.com"
fi
echo "user_name=$user_name" >> $GITHUB_ENV
echo "user_email=$user_email" >> $GITHUB_ENV
- name: Bump Version (Minor)
run: |
git config --global user.email "${{ env.user_email }}"
git config --global user.name "${{ env.user_name }}"
npm version minor
git push origin main --tag
20 changes: 17 additions & 3 deletions .github/workflows/version-patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,23 @@ jobs:
node-version: ${{env.NODE_VERSION}}
registry-url: https://registry.npmjs.org/

- name: Get GitHub User Info
id: user_info
run: |
# GitHub API를 사용하여 트리거한 사용자의 이메일과 이름 가져오기
user_name="${{ github.actor }}"
user_email=$(curl -s https://api.github.com/users/${{ github.actor }} | jq -r '.email')
if [ -z "$user_email" ] || [ "$user_email" = "null" ]; then
user_email="${{ github.actor }}@users.noreply.github.com"
fi
echo "user_name=$user_name" >> $GITHUB_ENV
echo "user_email=$user_email" >> $GITHUB_ENV
- name: Bump Version (Patch)
run: |
git config --global user.email "[email protected]"
git config --global user.name "principes-getp"
git config --global user.email "${{ env.user_email }}"
git config --global user.name "${{ env.user_name }}"
npm version patch
git push origin main
git push origin main --tag

0 comments on commit b60a8d9

Please sign in to comment.