shotgun adjustment #295
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 and Commit Hash | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
update-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Git | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Increment version number | |
run: | | |
version_file="versionEnum.txt" | |
version=$(cat $version_file) | |
new_version=$((version + 1)) | |
echo $new_version > $version_file | |
echo "new_version=$new_version" >> $GITHUB_ENV | |
- name: Update commit hash | |
run: | | |
hash_file="versionHash.txt" | |
commit_hash=$(git rev-parse HEAD) | |
echo $commit_hash > $hash_file | |
- name: Commit changes | |
run: | | |
git add versionEnum.txt versionHash.txt | |
git commit -m "Increment version to $new_version and update commit hash" | |
git push | |
- name: Push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git push origin main |