Merge pull request #42 from Muddyblack/34-update-readme #92
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: Update Version JSON | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
update-version-json: | |
if: github.actor != 'github-actions[bot]' && github.event_name == 'push' && github.event.head_commit.message != 'Update version.json with latest commit code' && contains(github.event.head_commit.message, 'STABLE') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.PAT }} | |
- name: Get commit code | |
run: echo "{commit_code}={$(git rev-parse HEAD)}" >> $GITHUB_OUTPUT | |
id: get_commit_code | |
- name: Update version.json | |
run: | | |
COMMIT_HASH=$(git rev-parse --short=7 HEAD) | |
sed -i "s/\"version\": \".*\"/\"version\": \"$COMMIT_HASH\"/g" version.json | |
- name: Commit and push changes | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git add version.json | |
git commit -m "Update version.json with latest commit code" | |
git push |