Skip to content

Commit

Permalink
Check if NIMS and NIMG versions are different before committing (#585)
Browse files Browse the repository at this point in the history
* Don't commit version changes if empty

* Add conditional for pushing commit to branch

* Use GITHUB_OUTPUT for check

* Move brackets outside whole expression

* Add a fi statement. Use a boolean variable
  • Loading branch information
dixonjoel authored Jan 12, 2024
1 parent 27b465e commit ed1f7c7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/Publish_NIMS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,20 @@ jobs:
working-directory: ./ni_measurementlink_generator

- name: Commit file changes
id: commit
if: ${{ startsWith(github.event.release.target_commitish, 'main') || startsWith(github.event.release.target_commitish, 'releases/') }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Promote NIMS package version and update Sphinx generated files in _docs" -a
echo "version_changed=false" >> $GITHUB_OUTPUT
if [ -n "$(git status --porcelain)" ]; then
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Promote NIMS and NIMG package version" -a
echo "version_changed=true" >> $GITHUB_OUTPUT
fi
- name: Push changes to the appropriate branch
if: ${{ startsWith(github.event.release.target_commitish, 'main') || startsWith(github.event.release.target_commitish, 'releases/') }}
if: ${{ steps.commit.outputs.version_changed && (startsWith(github.event.release.target_commitish, 'main') || startsWith(github.event.release.target_commitish, 'releases/')) }}
uses: CasperWA/push-protected@v2
with:
token: ${{ secrets.ADMIN_PAT }}
Expand Down

0 comments on commit ed1f7c7

Please sign in to comment.