Created
November 25, 2021 16:02
-
-
Save Broxzier/1ed980b8b3822d213e98042fc6a92040 to your computer and use it in GitHub Desktop.
GitHub Action to update a version file on PR merge
This file contains hidden or 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: Update file on PR merge | |
on: | |
pull_request: | |
branches: | |
- master | |
- develop | |
types: closed | |
jobs: | |
update_date: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
with: | |
# Fetch full depth, otherwise the last step overwrites the last commit's parent, essentially removing the graph. | |
fetch-depth: 0 | |
- name: Update version.txt | |
run: | | |
sed -ri 's/(.*FileVersion = )([0-9]+)(.*)/echo "\1$((\2+1))\3"/ge' version.txt | |
- name: Amend the last commit | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "OpenRCT2 git bot" | |
git commit -a --amend --no-edit | |
git push --force-with-lease | |
echo "Complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! Just what I needed to write a bump-version script