Skip to content

Commit

Permalink
Fix version type definition
Browse files Browse the repository at this point in the history
  • Loading branch information
mmosca committed Jun 13, 2024
1 parent 01df8f7 commit f41dd60
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/dev-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ jobs:
COMMIT_ID=${COMMIT_ID:-${{ github.sha }}}
BUILD_SUFFIX=dev-$(date '+%Y%m%d')-$(git rev-parse --short ${COMMIT_ID})
VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }')
echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
#echo "BUILD_SUFFIX=${BUILD_SUFFIX}" >> $GITHUB_ENV
#echo "BUILD_NAME=inav-${VERSION}-${BUILD_SUFFIX}" >> $GITHUB_ENV
#echo "VERSION_TAG=-$(date '+%Y%m%d')" >> $GITHUB_ENV
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Build SITL
run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -G Ninja .. && ninja
run: mkdir -p build_SITL && cd build_SITL && cmake -DSITL=ON -DWARNINGS_AS_ERRORS=ON -DVERSION_TYPE="dev" -G Ninja .. && ninja
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -163,6 +165,12 @@ jobs:
needs: [build, build-SITL-Linux, build-SITL-Mac, build-SITL-Windows, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version
id: version
run: |
VERSION=$(grep project CMakeLists.txt|awk -F VERSION '{ gsub(/[ \t\)]+/, "", $2); print $2 }')
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Get current date
id: date
run: echo "today=$(date '+%Y%m%d')" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -196,7 +204,7 @@ jobs:
- name: Upload release artifacts
uses: softprops/action-gh-release@v2
with:
name: inav-dev-release-${{ steps.date.outputs.today }}-${{ github.run_number }}-${{ github.sha}}
name: inav-${{ steps.version.outputs.version }}-dev-${{ steps.date.outputs.today }}-${{ github.run_number }}-${{ github.sha }}
tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }}
# To create release on a different repo, we need a token setup
#token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ set(COMMON_COMPILE_DEFINITIONS
FC_VERSION_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR}
FC_VERSION_MINOR=${CMAKE_PROJECT_VERSION_MINOR}
FC_VERSION_PATCH_LEVEL=${CMAKE_PROJECT_VERSION_PATCH}
FC_VERSION_TYPE="${VERSION_TYPE}"
)

if (NOT SITL)
Expand Down
4 changes: 4 additions & 0 deletions src/main/build/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#define FC_VERSION_STRING STR(FC_VERSION_MAJOR) "." STR(FC_VERSION_MINOR) "." STR(FC_VERSION_PATCH_LEVEL)
#ifndef FC_VERSION_TYPE
#define FC_VERSION_TYPE ""
#endif
#define FC_FIRMWARE_NAME "INAV"


#define MW_VERSION 231

extern const char* const compilerVersion;
Expand Down
10 changes: 6 additions & 4 deletions src/main/fc/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -3662,13 +3662,14 @@ static void cliStatus(char *cmdline)
char buf[MAX(FORMATTED_DATE_TIME_BUFSIZE, SETTING_MAX_NAME_LENGTH)];
dateTime_t dt;

cliPrintLinef("%s/%s %s %s / %s (%s)",
cliPrintLinef("%s/%s %s %s / %s (%s) %s",
FC_FIRMWARE_NAME,
targetName,
FC_VERSION_STRING,
buildDate,
buildTime,
shortGitRevision
shortGitRevision,
FC_VERSION_TYPE
);
cliPrintLinef("GCC-%s",
compilerVersion
Expand Down Expand Up @@ -3906,13 +3907,14 @@ static void cliVersion(char *cmdline)
{
UNUSED(cmdline);

cliPrintLinef("# %s/%s %s %s / %s (%s)",
cliPrintLinef("# %s/%s %s %s / %s (%s) %s",
FC_FIRMWARE_NAME,
targetName,
FC_VERSION_STRING,
buildDate,
buildTime,
shortGitRevision
shortGitRevision,
FC_VERSION_TYPE
);
cliPrintLinef("# GCC-%s",
compilerVersion
Expand Down

0 comments on commit f41dd60

Please sign in to comment.