Skip to content

Commit

Permalink
Update version in sourcecode on release
Browse files Browse the repository at this point in the history
  • Loading branch information
foorschtbar committed Feb 12, 2023
1 parent 86cab5d commit e9d8ffa
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/updateversion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import re
import sys

if len(sys.argv) < 2:
print("Usage: python3 updateversion.py <version>")
sys.exit(1)

tag = sys.argv[1]

content_new = ''
with open ('./src/PixelIt.ino', 'r' ) as f:
content = f.read()
content_new = re.sub('(#define\s+VERSION\s+\")(.*)(\")', r'\g<1>'+ tag + r'\g<3>', content, flags = re.M)
f.close()

if content_new != "":
with open ('./src/PixelIt.ino', 'w' ) as f:
f.write(content_new)
f.close()
4 changes: 4 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ jobs:
run: |
python .github/webui.py
- name: Update version in PixelIt.ino 🔧
run: |
python .github/updateversion.py ${{ github.ref_name }}
- name: Install pio and its dependencies 🔧
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion src/PixelIt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#define CHECKUPDATESCREEN_INTERVAL 1000 * 60 * 5 // 5 Minutes
#define CHECKUPDATESCREEN_DURATION 1000 * 5 // 5 Seconds

#define VERSION "2.2.0"
#define VERSION "2.3.0-beta"

void FadeOut(int = 10, int = 0);
void FadeIn(int = 10, int = 0);
Expand Down

0 comments on commit e9d8ffa

Please sign in to comment.