-
-
Notifications
You must be signed in to change notification settings - Fork 93
39 lines (32 loc) · 1.27 KB
/
version.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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