Skip to content
Closed
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
80 changes: 80 additions & 0 deletions .github/scripts/compute-semver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/usr/bin/env bash

set -euo pipefail

echo "Determining next SemVer..."

if [ -z "${GITHUB_TOKEN:-}" ]; then
echo "GITHUB_TOKEN not set"
exit 1
fi

OWNER="${GITHUB_REPOSITORY%%/*}"
REPO="${GITHUB_REPOSITORY##*/}"
SHA="${GITHUB_SHA}"

git fetch --tags
LATEST_TAG=$(git tag --list 'v*.*.*' --sort=-v:refname | head -n1 || true)

if [ -z "$LATEST_TAG" ]; then
LATEST_TAG="v0.0.0"
fi

echo "Latest tag: $LATEST_TAG"

VERSION="${LATEST_TAG#v}"
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"

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")

echo "$PRS_JSON" | jq .

PR_COUNT=$(echo "$PRS_JSON" | jq length)

if [ "$PR_COUNT" -eq 0 ]; then
echo "No PR associated with this commit."
exit 1
fi

LABELS=$(echo "$PRS_JSON" | jq -r '.[0].labels[].name' | tr '[:upper:]' '[:lower:]')

BUMP="patch"

COUNT=0
for LABEL in major minor patch; do
if echo "$LABELS" | grep -qx "$LABEL"; then
BUMP="$LABEL"
COUNT=$((COUNT+1))
fi
done

if [ "$COUNT" -gt 1 ]; then
echo "Multiple SemVer labels applied. Use only one of: major, minor, patch."
exit 1
fi

echo "Version bump type: $BUMP"

case "$BUMP" in
major)
MAJOR=$((MAJOR+1))
MINOR=0
PATCH=0
;;
minor)
MINOR=$((MINOR+1))
PATCH=0
;;
patch)
PATCH=$((PATCH+1))
;;
esac

NEW_TAG="v${MAJOR}.${MINOR}.${PATCH}"

echo "New tag: $NEW_TAG"

echo "tag=$NEW_TAG" >> "$GITHUB_OUTPUT"
48 changes: 48 additions & 0 deletions .github/scripts/get-pr-details.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

#!/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."
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 // ""')

{
echo "title<<EOF"
echo "$TITLE"
echo "EOF"
} >> "$GITHUB_OUTPUT"

{
echo "body<<EOF"
echo "$BODY"
echo "EOF"
} >> "$GITHUB_OUTPUT"

echo "PR details captured."
echo "- Title = $TITLE."
echo "- Description = $BODY."
29 changes: 29 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI - Build Installer

on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Restore
run: dotnet restore

- name: Build (Release)
run: dotnet build -c Release --no-restore
67 changes: 67 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CD - Deploy, Label, and Create Release

on:
push:
branches:
- main

permissions:
contents: write

concurrency:
group: release-main
cancel-in-progress: false

jobs:
release:
runs-on: windows-latest

steps:
- name: Checkout (full history)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Determine next SemVer from PR labels
id: semver
run: bash .github/scripts/compute-semver.sh
env:
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 }}

- name: Restore
run: dotnet restore

- name: Publish single-file installer
run: |
dotnet publish -c Release \
-r win-x64 \
--self-contained true \
-p:PublishSingleFile=true \
-p:IncludeNativeLibrariesForSelfExtract=true \
-p:Version=${{ steps.semver.outputs.tag }} \
-o publish

- name: Rename output for clean artifact name
run: |
ren publish\*.exe LumenLabInstaller-${{ steps.semver.outputs.tag }}.exe

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.semver.outputs.tag }}
name: ${{ steps.semver.outputs.tag }} - ${{ steps.pr_details.outputs.title }}
body: ${{ steps.pr_details.outputs.body }}
files: publish/LumenLabInstaller-${{ steps.semver.outputs.tag }}.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,9 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd

Firmware/ConfigurationSetup/.gitignore
Firmware/ConfigurationSetup/.pio
Firmware/ConfigurationSetup/.vscode/*
!Firmware/ConfigurationSetup/.vscode/extensions.json
13 changes: 13 additions & 0 deletions Configuration/AppConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LumenLabInstaller.Configuration
{
internal static class AppConstants
{
public static string GithubReleasesUrl = "https://api.github.com/repos/ericmcdaniel/lumenlab/releases";
}
}
10 changes: 10 additions & 0 deletions Firmware/ConfigurationSetup/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
22 changes: 22 additions & 0 deletions Firmware/ConfigurationSetup/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[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.

[env]
upload_speed = 115200
monitor_speed = 115200


[env:debug]
platform = espressif32
board = upesy_wroom
framework = arduino
build_unflags = -std=gnu++11
build_flags = -Os -DDEBUG -std=gnu++2a

[env:release]
platform = espressif32
board = upesy_wroom
framework = arduino
build_unflags = -std=gnu++11
build_flags = -Os -DRELEASE -std=gnu++2a
Loading
Loading