mirror of
https://github.com/SlimeVR/SlimeVR-Tracker-ESP.git
synced 2026-04-06 02:01:57 +02:00
CI: Have firmware version be assigned by git + Create draft release from new tag build (#360)
* Have firmware version be assigned by git + Create draft release from new tag build * Fix quotes * Short commit id * Fix function call * clang-format
This commit is contained in:
11
.github/workflows/actions.yml
vendored
11
.github/workflows/actions.yml
vendored
@@ -5,6 +5,8 @@ on:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
create:
|
||||
|
||||
jobs:
|
||||
format:
|
||||
@@ -55,3 +57,12 @@ jobs:
|
||||
with:
|
||||
name: binaries
|
||||
path: ./build/*.bin
|
||||
|
||||
- name: Upload to draft release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
draft: true
|
||||
generate_release_notes: true
|
||||
files: |
|
||||
./build/BOARD_SLIMEVR-firmware.bin
|
||||
|
||||
@@ -9,11 +9,44 @@ if not env_rev is None and env_rev != "":
|
||||
else:
|
||||
try:
|
||||
revision = (
|
||||
subprocess.check_output(["git", "rev-parse", "HEAD"])
|
||||
subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])
|
||||
.strip()
|
||||
.decode("utf-8")
|
||||
)
|
||||
except Exception:
|
||||
revision = "NOT_GIT"
|
||||
|
||||
print(f"'-DGIT_REV=\"{revision}\"'")
|
||||
tag = ""
|
||||
try:
|
||||
tag = (
|
||||
subprocess.check_output(["git", "--no-pager", "tag", "--sort", "-taggerdate", "--points-at" , "HEAD"])
|
||||
.split("\n")[0]
|
||||
.strip()
|
||||
.decode("utf-8")
|
||||
)
|
||||
|
||||
if tag.startswith("v"):
|
||||
tag = tag[1:]
|
||||
except Exception:
|
||||
tag = ""
|
||||
|
||||
branch = ""
|
||||
try:
|
||||
branch = (
|
||||
subprocess.check_output(["git", "symbolic-ref", "--short", "-q", "HEAD"])
|
||||
.strip()
|
||||
.decode("utf-8")
|
||||
)
|
||||
except Exception:
|
||||
branch = ""
|
||||
|
||||
output = f"'-DGIT_REV=\"{revision}\"'"
|
||||
|
||||
if tag != "":
|
||||
output += f" '-DFIRMWARE_VERSION=\"{tag}\"'"
|
||||
if tag == "" and branch != "":
|
||||
output += f" '-DFIRMWARE_VERSION=\"{branch}\"'"
|
||||
else:
|
||||
output += f" '-DFIRMWARE_VERSION=\"git-{revision}\"'"
|
||||
|
||||
print(output)
|
||||
|
||||
@@ -95,6 +95,9 @@
|
||||
#define ENABLE_INSPECTION false
|
||||
|
||||
#define PROTOCOL_VERSION 18
|
||||
#define FIRMWARE_VERSION "0.5.0"
|
||||
|
||||
#ifndef FIRMWARE_VERSION
|
||||
#define FIRMWARE_VERSION "UNKNOWN"
|
||||
#endif
|
||||
|
||||
#endif // SLIMEVR_DEBUG_H_
|
||||
|
||||
Reference in New Issue
Block a user