Feature/test version bump #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Version Bump | |
on: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- 'main' | |
jobs: | |
check_and_bump_version: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup nodejs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- run: npm ci | |
- run: | | |
echo The PR was merged | |
if git diff --name-only ${{ toJson(github.event.pull_request.base.sha) }} ${{ toJson(github.event.pull_request.head.sha) }} | grep fate-product-list.csv | |
then | |
# Note: the following account information will not work on GHES | |
# Taken from the checkout github action, used above, at https://github.com/actions/checkout | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
if npm version major -m "Version updated to %s because product list changed." | |
then | |
echo "Version updated to " $( jq .version package.json ) "." | |
git push --follow-tags | |
else | |
echo "Couldn't update version for some reason." | |
fi | |
else | |
echo "No changes to product list." | |
fi | |