diff --git a/.github/scripts/compute-semver.sh b/.github/scripts/compute-semver.sh index 7368cd7..ec10afa 100644 --- a/.github/scripts/compute-semver.sh +++ b/.github/scripts/compute-semver.sh @@ -73,8 +73,9 @@ case "$BUMP" in ;; esac -NEW_TAG="v${MAJOR}.${MINOR}.${PATCH}" +NEW_TAG="${MAJOR}.${MINOR}.${PATCH}" -echo "New tag: $NEW_TAG" +echo "New tag: v$NEW_TAG" -echo "tag=$NEW_TAG" >> "$GITHUB_OUTPUT" +echo "version=$NEW_TAG" >> "$GITHUB_OUTPUT" +echo "tag=v$NEW_TAG" >> "$GITHUB_OUTPUT" diff --git a/.github/scripts/get-pr-details.sh b/.github/scripts/get-pr-details.sh index 339ac25..feb2233 100644 --- a/.github/scripts/get-pr-details.sh +++ b/.github/scripts/get-pr-details.sh @@ -1,35 +1,16 @@ - #!/usr/bin/env bash - set -euo pipefail -echo "Retrieving PR information..." - -if [ -z "${GITHUB_TOKEN:-}" ]; then - echo "GITHUB_TOKEN not set" - exit 1 -fi - -OWNER="${GITHUB_REPOSITORY%%/*}" -REPO="${GITHUB_REPOSITORY##*/}" -SHA="${GITHUB_SHA}" - -PRS_JSON=$(curl -s \ - -H "Authorization: Bearer $GITHUB_TOKEN" \ - -H "Accept: application/vnd.github+json" \ - "https://api.github.com/repos/$OWNER/$REPO/commits/$SHA/pulls") - -PR_COUNT=$(echo "$PRS_JSON" | jq length) - -if [ "$PR_COUNT" -eq 0 ]; then - echo "No PR associated with this commit." +if [ -z "${PR_NUMBER:-}" ]; then + echo "No PR number provided, skipping release notes." echo "title=" >> "$GITHUB_OUTPUT" echo "body=" >> "$GITHUB_OUTPUT" exit 0 fi -TITLE=$(echo "$PRS_JSON" | jq -r '.[0].title // ""') -BODY=$(echo "$PRS_JSON" | jq -r '.[0].body // ""') +PR_JSON=$(gh pr view "$PR_NUMBER" --json title,body) +TITLE=$(echo "$PR_JSON" | jq -r '.title // ""') +BODY=$(echo "$PR_JSON" | jq -r '.body // ""') { echo "title<> "$GITHUB_OUTPUT" -echo "PR details captured." -echo "- Title = $TITLE." -echo "- Description = $BODY." \ No newline at end of file +echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT" \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 879ecf2..19ef314 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,26 +17,6 @@ jobs: with: fetch-depth: 0 - - name: Cache pip and PlatformIO - uses: actions/cache@v4 - with: - path: | - ~/.cache/pip - ~/.platformio/.cache - key: ${{ runner.os }}-pio-${{ hashFiles('**/platformio.ini') }} - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install PlatformIO - run: pip install --upgrade platformio - - - name: Build NVS Writer Firmware - working-directory: Firmware/ConfigurationSetup - run: pio run -e release - - name: Setup .NET uses: actions/setup-dotnet@v4 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 85861c0..e740051 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,6 +7,7 @@ on: permissions: contents: write + pull-requests: write concurrency: group: release-main @@ -22,15 +23,36 @@ jobs: with: fetch-depth: 0 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' + - name: Determine PR number + id: pr + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + PR_NUMBER=$(gh pr list \ + --state merged \ + --base main \ + --json number,mergeCommit \ + --jq '.[] | select(.mergeCommit.oid=="'"$GITHUB_SHA"'") | .number') + if [[ -z "$PR_NUMBER" ]]; then + echo "No PR associated with this commit; skipping release." + echo "run_release=false" >> $GITHUB_OUTPUT + else + echo "Found PR #$PR_NUMBER" + echo "run_release=true" >> $GITHUB_OUTPUT + echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT + fi - - name: Determine next SemVer from PR labels + - name: Determine next version id from PR labels id: semver - run: bash .github/scripts/compute-semver.sh + shell: bash + run: | + PR_NUMBER=${{ steps.pr.outputs.pr_number }} + export PR_NUMBER + bash .github/scripts/compute-semver.sh + echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT" env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Get release description notes from PR @@ -38,18 +60,26 @@ jobs: run: bash .github/scripts/get-pr-details.sh env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ steps.semver.outputs.pr_number }} + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' - - name: Restore + - name: .NET Restore run: dotnet restore - name: Publish single-file installer + shell: bash run: | - dotnet publish -c Release \ + dotnet publish lumenlab-installer.csproj \ + -c Release \ -r win-x64 \ --self-contained true \ -p:PublishSingleFile=true \ -p:IncludeNativeLibrariesForSelfExtract=true \ - -p:Version=${{ steps.semver.outputs.tag }} \ + -p:Version=${{ steps.semver.outputs.version }} \ -o publish - name: Rename output for clean artifact name diff --git a/Firmware/ConfigurationSetup/LumenLabInstaller.code-workspace b/Firmware/ConfigurationSetup/LumenLabInstaller.code-workspace index bc0d57f..9e85f60 100644 --- a/Firmware/ConfigurationSetup/LumenLabInstaller.code-workspace +++ b/Firmware/ConfigurationSetup/LumenLabInstaller.code-workspace @@ -1,7 +1,7 @@ { "folders": [ { - "path": "ConfigurationSetup" + "path": "." } ], "settings": { diff --git a/Firmware/ConfigurationSetup/build/bootloader.bin b/Firmware/ConfigurationSetup/build/bootloader.bin new file mode 100644 index 0000000..6f55376 Binary files /dev/null and b/Firmware/ConfigurationSetup/build/bootloader.bin differ diff --git a/Firmware/ConfigurationSetup/build/firmware.bin b/Firmware/ConfigurationSetup/build/firmware.bin new file mode 100644 index 0000000..0dca9c6 Binary files /dev/null and b/Firmware/ConfigurationSetup/build/firmware.bin differ diff --git a/Firmware/ConfigurationSetup/build/partitions.bin b/Firmware/ConfigurationSetup/build/partitions.bin new file mode 100644 index 0000000..2108af9 Binary files /dev/null and b/Firmware/ConfigurationSetup/build/partitions.bin differ diff --git a/Firmware/ConfigurationSetup/platformio.ini b/Firmware/ConfigurationSetup/platformio.ini index 06b52f7..e8de475 100644 --- a/Firmware/ConfigurationSetup/platformio.ini +++ b/Firmware/ConfigurationSetup/platformio.ini @@ -1,9 +1,9 @@ [platformio] name = LumenLab Installation Tool -description = A Windows-only installation tool to easily write NVS memory preferences on demand for global reference and config for the LumenLab. +description = A Windows-only installation tool helper to easily write NVS memory preferences on demand for global reference and config for the LumenLab. [env] -upload_speed = 115200 +upload_speed = 921600 monitor_speed = 115200 diff --git a/Firmware/ConfigurationSetup/src/main.cpp b/Firmware/ConfigurationSetup/src/main.cpp index 77486df..f0e99ac 100644 --- a/Firmware/ConfigurationSetup/src/main.cpp +++ b/Firmware/ConfigurationSetup/src/main.cpp @@ -177,6 +177,24 @@ void dumpAll() Serial.println(value); } } + const char *knownHighScores[] = { + "recall-high", + "phase-high"}; + + for (auto key : knownHighScores) + { + if (!preferences.isKey(key)) + { + Serial.print(key); + Serial.println(" is not in memory."); + continue; + } + + auto value = preferences.getUInt(key, 0); + Serial.print(key); + Serial.print("="); + Serial.println(value); + } preferences.end(); diff --git a/lumenlab-installer.csproj b/lumenlab-installer.csproj index a1cfa04..9b653f4 100644 --- a/lumenlab-installer.csproj +++ b/lumenlab-installer.csproj @@ -18,18 +18,14 @@ $(Version) - - - - - + Firmware.firmware.bin - + Firmware.bootloader.bin - + Firmware.partitions.bin