Skip to content

Commit

Permalink
chore(ci): upgrade package version based on branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
amine-abdelli committed Sep 30, 2023
1 parent a90fd3b commit 9b48737
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
types: [closed]
branches:
- develop
- master

jobs:
update_version:
Expand All @@ -13,9 +13,16 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Get the source branch name
id: get_source_branch_name
run: echo ::set-output name=branch::${{ github.event.pull_request.head.ref }}

- name: Update package version
run: |
if [[ ${{ github.ref }} == refs/heads/feat/* ]]; then
BRANCH_NAME="${{ steps.get_source_branch_name.outputs.branch }}"
if [[ $BRANCH_NAME == break/* ]]; then
npm version major --no-git-tag-version
elif [[ $BRANCH_NAME == feat/* ]]; then
npm version minor --no-git-tag-version
else
npm version patch --no-git-tag-version
Expand All @@ -31,5 +38,5 @@ jobs:
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
branch: ${{ github.event.pull_request.base.ref }}
force: true

0 comments on commit 9b48737

Please sign in to comment.