Merge branch 'master' of https://github.com/fredlcore/BSB_LAN #264
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 Compile Time | |
on: [push] | |
jobs: | |
update-compiletime: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Ensures all history is fetched | |
- name: Reset Repository to Remote State | |
run: | | |
git fetch origin | |
git reset --hard origin/master | |
- name: Get current commit timestamp and update files | |
run: | | |
TIMESTAMP=$(git show -s --format=%cd --date=format:'%Y%m%d%H%M%S' HEAD) | |
PATCH_NUMBER=$(grep '#define PATCH' BSB_LAN/bsb-version.h | cut -d '"' -f 2) | |
NEW_PATCH_NUMBER=$((PATCH_NUMBER + 1)) | |
sed -i "s/#define PATCH \".*\"/#define PATCH \"$NEW_PATCH_NUMBER\"/" BSB_LAN/bsb-version.h | |
sed -i 's/^#define COMPILETIME .*$/#define COMPILETIME "'"$TIMESTAMP"'"/' BSB_LAN/bsb-version.h | |
- name: Setup git config | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "GitHub Action" | |
- name: Commit changes | |
run: | | |
git add BSB_LAN/bsb-version.h | |
git commit --amend --no-edit # Keeps the previous commit message. | |
git fetch | |
git rebase origin/master | |
git push --force-with-lease origin HEAD:master |