Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/scripts/compute-semver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
33 changes: 6 additions & 27 deletions .github/scripts/get-pr-details.sh
Original file line number Diff line number Diff line change
@@ -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<<EOF"
Expand All @@ -43,6 +24,4 @@ BODY=$(echo "$PRS_JSON" | jq -r '.[0].body // ""')
echo "EOF"
} >> "$GITHUB_OUTPUT"

echo "PR details captured."
echo "- Title = $TITLE."
echo "- Description = $BODY."
echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
20 changes: 0 additions & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
48 changes: 39 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

permissions:
contents: write
pull-requests: write

concurrency:
group: release-main
Expand All @@ -22,34 +23,63 @@ 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
id: pr_details
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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"folders": [
{
"path": "ConfigurationSetup"
"path": "."
}
],
"settings": {
Expand Down
Binary file added Firmware/ConfigurationSetup/build/bootloader.bin
Binary file not shown.
Binary file added Firmware/ConfigurationSetup/build/firmware.bin
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions Firmware/ConfigurationSetup/platformio.ini
Original file line number Diff line number Diff line change
@@ -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


Expand Down
18 changes: 18 additions & 0 deletions Firmware/ConfigurationSetup/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
10 changes: 3 additions & 7 deletions lumenlab-installer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,14 @@
<FileVersion>$(Version)</FileVersion>
</PropertyGroup>

<Target Name="BuildNvsWriterFirmware" BeforeTargets="BeforeBuild" Condition="'$(Configuration)' == 'Release'">
<Exec WorkingDirectory="Firmware\ConfigurationSetup" Command="pio run -e release" />
</Target>

<ItemGroup>
<EmbeddedResource Include="Firmware\ConfigurationSetup\.pio\build\release\firmware.bin">
<EmbeddedResource Include="Firmware\ConfigurationSetup\build\firmware.bin">
<LogicalName>Firmware.firmware.bin</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Firmware\ConfigurationSetup\.pio\build\release\bootloader.bin">
<EmbeddedResource Include="Firmware\ConfigurationSetup\build\bootloader.bin">
<LogicalName>Firmware.bootloader.bin</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Firmware\ConfigurationSetup\.pio\build\release\partitions.bin">
<EmbeddedResource Include="Firmware\ConfigurationSetup\build\partitions.bin">
<LogicalName>Firmware.partitions.bin</LogicalName>
</EmbeddedResource>
</ItemGroup>
Expand Down
Loading