Skip to content

Commit

Permalink
chore(fix): not commit if version is the same
Browse files Browse the repository at this point in the history
  • Loading branch information
bucurdavid committed Feb 26, 2024
1 parent 5b87e7a commit 3d569ba
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/semantic_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,24 @@ jobs:
- name: Use the version
run: echo "The version is ${{ steps.semantic.outputs.version }}"

- name: Check if version needs to be updated
id: check_version
run: |
current_version=$(jq -r '.version' package.json)
new_version="${{ steps.semantic.outputs.version }}"
if [ "$current_version" != "$new_version" ]; then
echo "::set-output name=version_updated::true"
else
echo "::set-output name=version_updated::false"
fi
- name: Update package.json with new version
if: steps.check_version.outputs.version_updated == 'true'
run: |
sed -i 's/"version": "[^"]*"/"version": "${{ steps.semantic.outputs.version }}"/' package.json
- name: Commit version update
if: steps.check_version.outputs.version_updated == 'true'
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
Expand Down

0 comments on commit 3d569ba

Please sign in to comment.