Skip to content

Merge branch 'master' of https://github.com/fredlcore/BSB_LAN #260

Merge branch 'master' of https://github.com/fredlcore/BSB_LAN

Merge branch 'master' of https://github.com/fredlcore/BSB_LAN #260

Workflow file for this run

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