Skip to content

Commit

Permalink
CI: Actually working firmware version detection (#365)
Browse files Browse the repository at this point in the history
* Fix firmware version detection

* Fix ci

* remove release workflow
  • Loading branch information
loucass003 authored Nov 16, 2024
1 parent 608fbd2 commit 9f20c12
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 40 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
tags:
- "*"
pull_request:
workflow_dispatch:
create:
Expand All @@ -17,15 +19,15 @@ jobs:
with:
clang-format-version: "17"
fallback-style: google
# Disable clang-tidy for now
# - name: Get clang-tidy
# run: |
# apt-get update
# apt-get install -y clang-tidy
# - uses: ZehMatt/[email protected]
# with:
# build_dir: 'build'
# cmake_args: '-G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++'
# Disable clang-tidy for now
# - name: Get clang-tidy
# run: |
# apt-get update
# apt-get install -y clang-tidy
# - uses: ZehMatt/[email protected]
# with:
# build_dir: 'build'
# cmake_args: '-G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++'

build:
runs-on: ubuntu-20.04
Expand All @@ -39,6 +41,9 @@ jobs:
~/.platformio/.cache
key: ${{ runner.os }}-pio

- name: Get tags
run: git fetch --tags origin --recurse-submodules=no --force

- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/release.yml

This file was deleted.

16 changes: 5 additions & 11 deletions scripts/get_git_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@

tag = ""
try:
tag = (
subprocess.check_output(["git", "--no-pager", "tag", "--sort", "-taggerdate", "--points-at" , "HEAD"])
.split("\n")[0]
.strip()
.decode("utf-8")
)

tag = subprocess.check_output(["git", "--no-pager", "tag", "--sort", "-taggerdate", "--points-at" , "HEAD"]).strip().decode("utf-8")
if tag.startswith("v"):
tag = tag[1:]
except Exception:
Expand All @@ -40,13 +34,13 @@
except Exception:
branch = ""

output = f"'-DGIT_REV=\"{revision}\"'"
output = f"-DGIT_REV='\"{revision}\"'"

if tag != "":
output += f" '-DFIRMWARE_VERSION=\"{tag}\"'"
output += f" -DFIRMWARE_VERSION='\"{tag}\"'"
elif branch != "":
output += f" '-DFIRMWARE_VERSION=\"{branch}\"'"
output += f" -DFIRMWARE_VERSION='\"{branch}\"'"
else:
output += f" '-DFIRMWARE_VERSION=\"git-{revision}\"'"
output += f" -DFIRMWARE_VERSION='\"git-{revision}\"'"

print(output)

0 comments on commit 9f20c12

Please sign in to comment.