Skip to content

Commit

Permalink
feat: add check for avoid execute steps if it's not necessary
Browse files Browse the repository at this point in the history
* fix: wrong env.example path

* chore: remove unnecessary files from release

* chore(ci): set new version to composer.json

* chore(ci): add check for avoid execute steps if it's not necessary
  • Loading branch information
cbatista8a authored Jul 6, 2024
1 parent 8ed7a62 commit 493567a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/semver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,26 @@ jobs:
rm -rf ./vendor ./tests ./phpunit.xml ./psalm.xml ./.github
composer install --no-dev
- name: Get the next version on dry-run # or set the current version if it's nothing to release
- name: Get the next version on dry-run # or get the current version if it's nothing to release
id: version
uses: huggingface/semver-release-action@latest
with:
dryRun: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check if there is a new version to release
id: check_release
run: |
CURRENT_VERSION=$(jq -r '.version' composer.json)
if [ "$CURRENT_VERSION" == "${{ steps.version.outputs.version }}" ]; then
echo "released=false" >> $GITHUB_OUTPUT
else
echo "released=true" >> $GITHUB_OUTPUT
fi
- name: Update composer.json with next version
if: ${{ steps.version.outputs.released == 'true' }}
if: ${{ steps.check_release.outputs.released == 'true' }}
run: |
NEXT_VERSION=${{ steps.version.outputs.version }}
jq --arg new_version "$NEXT_VERSION" '.version = $new_version' composer.json > composer.json.tmp && mv composer.json.tmp composer.json
Expand All @@ -85,6 +95,7 @@ jobs:
git push
- name: Release
if: ${{ steps.check_release.outputs.released == 'true' }}
id: semver
uses: huggingface/semver-release-action@latest
env:
Expand Down

0 comments on commit 493567a

Please sign in to comment.