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
95 changes: 95 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Build and Release

on:
push:
tags:
- 'v*.*.*'

permissions:
contents: write

jobs:
build-and-release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for changelog

- name: Validate tag format
run: |
TAG="${GITHUB_REF#refs/tags/}"
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then
echo "ERROR: Tag must match semantic version format (v1.2.3)"
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message on line 25 states the expected format as "v1.2.3" but the regex pattern on line 24 also accepts pre-release versions like "v1.2.3-beta". The error message should be updated to reflect this: "Expected: v1.2.3 or v1.2.3-prerelease" to accurately describe what formats are accepted.

Suggested change
echo "ERROR: Tag must match semantic version format (v1.2.3)"
echo "ERROR: Tag must match semantic version format (v1.2.3 or v1.2.3-prerelease)"

Copilot uses AI. Check for mistakes.
exit 1
fi
echo "TAG=$TAG" >> $GITHUB_ENV

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install arduino-cli
run: |
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
echo "$PWD/bin" >> $GITHUB_PATH

- name: Install ESP32 platform and dependencies
run: |
${{ github.workspace }}/bin/arduino-cli config init
${{ github.workspace }}/bin/arduino-cli config add board_manager.additional_urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
${{ github.workspace }}/bin/arduino-cli core update-index
${{ github.workspace }}/bin/arduino-cli core install esp32:esp32
${{ github.workspace }}/bin/arduino-cli lib install "LiquidCrystal"
Comment on lines +35 to +46
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow uses hardcoded paths like "${{ github.workspace }}/bin/arduino-cli" throughout steps 42-46. This path reference is correct, but the pattern is inconsistent with step 38 which uses "$PWD/bin". Consider using "${{ github.workspace }}/bin" consistently in step 38 as well for clarity and maintainability.

Copilot uses AI. Check for mistakes.

- name: Build release package
run: |
chmod +x build_release.sh
./build_release.sh "$TAG"

- name: Generate changelog
id: changelog
run: |
# Get previous tag
PREV_TAG=$(git describe --tags --abbrev=0 "$TAG^" 2>/dev/null || echo "")

if [ -n "$PREV_TAG" ]; then
echo "## Changes since $PREV_TAG" > CHANGELOG.md
echo "" >> CHANGELOG.md
git log --pretty=format:"- %s (%h)" "$PREV_TAG..$TAG" >> CHANGELOG.md
else
echo "## Initial Release" > CHANGELOG.md
echo "" >> CHANGELOG.md
echo "First release of SledLink firmware and tools." >> CHANGELOG.md
fi

echo "" >> CHANGELOG.md
echo "## Installation" >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "1. Download \`SledLink-$TAG.zip\` below" >> CHANGELOG.md
echo "2. Unzip the package" >> CHANGELOG.md
echo "3. See \`UPLOAD_GUIDE.md\` in the package for installation instructions" >> CHANGELOG.md

cat CHANGELOG.md

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
name: SledLink ${{ env.TAG }}
body_path: CHANGELOG.md
files: |
release/SledLink-${{ env.TAG }}.zip
draft: false
prerelease: ${{ contains(env.TAG, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: release-package
path: release/SledLink-${{ env.TAG }}.zip
retention-days: 30
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Compile Test

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]

jobs:
compile-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install arduino-cli
run: |
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
echo "$PWD/bin" >> $GITHUB_PATH

- name: Install ESP32 platform
run: |
${{ github.workspace }}/bin/arduino-cli config init
${{ github.workspace }}/bin/arduino-cli config add board_manager.additional_urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
${{ github.workspace }}/bin/arduino-cli core update-index
${{ github.workspace }}/bin/arduino-cli core install esp32:esp32
${{ github.workspace }}/bin/arduino-cli lib install "LiquidCrystal"
Comment on lines +16 to +27
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow uses hardcoded paths like "${{ github.workspace }}/bin/arduino-cli" throughout steps 22-27. This path reference is correct, but the pattern is inconsistent with step 19 which uses "$PWD/bin". Consider using "${{ github.workspace }}/bin" consistently in step 19 as well for clarity and maintainability.

Copilot uses AI. Check for mistakes.

- name: Compile SledController
run: |
${{ github.workspace }}/bin/arduino-cli compile --fqbn esp32:esp32:esp32 arduino/SledController

- name: Compile JudgeController
run: |
${{ github.workspace }}/bin/arduino-cli compile --fqbn esp32:esp32:esp32 arduino/JudgeController
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ Thumbs.db
*.bak
*.swp
*~

# Release artifacts
release/
*.zip
14 changes: 14 additions & 0 deletions UPLOAD_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

This guide explains how to upload firmware to your SledLink controllers. No technical knowledge is required - just follow the steps below.

## Getting SledLink

The latest SledLink release package is available on GitHub:

**[Download Latest Release](https://github.com/thompcd/SledLink/releases/latest)**

Each release includes:
- Pre-compiled firmware binaries (ready to flash)
- Upload and flash scripts
- Source code
- This guide

---

## What You'll Need

1. **Your SledLink controller** (either the Sled or Judge unit)
Expand Down
15 changes: 14 additions & 1 deletion arduino/JudgeController/JudgeController.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
#include <esp_now.h>
#include <LiquidCrystal.h>

// ============================================================================
// VERSION INFORMATION
// ============================================================================
#define FIRMWARE_DISPLAY_VERSION "v1.0.0" // User-facing version on LCD
#ifndef BUILD_VERSION
#define BUILD_VERSION "dev" // Injected during release build
#endif

// ============================================================================
// PIN DEFINITIONS
// ============================================================================
Expand Down Expand Up @@ -106,8 +114,13 @@ void setup() {

Serial.print("\r\n");
Serial.print("========================================\r\n");
Serial.print(" SledLink Judge Controller v3.0\r\n");
Serial.print(" SledLink Judge Controller ");
Serial.print(FIRMWARE_DISPLAY_VERSION);
Serial.print("\r\n");
Serial.print(" Tractor Pull Distance Display\r\n");
Serial.print(" Build: ");
Serial.print(BUILD_VERSION);
Serial.print("\r\n");
Serial.print("========================================\r\n");
Serial.print("\r\n");

Expand Down
15 changes: 14 additions & 1 deletion arduino/SledController/SledController.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
#include <esp_now.h>
#include <LiquidCrystal.h>

// ============================================================================
// VERSION INFORMATION
// ============================================================================
#define FIRMWARE_DISPLAY_VERSION "v1.0.0" // User-facing version on LCD
#ifndef BUILD_VERSION
#define BUILD_VERSION "dev" // Injected during release build
#endif

// ============================================================================
// PIN DEFINITIONS
// ============================================================================
Expand Down Expand Up @@ -150,8 +158,13 @@ void setup() {

Serial.print("\r\n");
Serial.print("========================================\r\n");
Serial.print(" SledLink Sled Controller v3.0\r\n");
Serial.print(" SledLink Sled Controller ");
Serial.print(FIRMWARE_DISPLAY_VERSION);
Serial.print("\r\n");
Serial.print(" Tractor Pull Distance Measurement\r\n");
Serial.print(" Build: ");
Serial.print(BUILD_VERSION);
Serial.print("\r\n");
Serial.print("========================================\r\n");
Serial.print("\r\n");

Expand Down
27 changes: 24 additions & 3 deletions build_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,21 @@
set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VERSION="${1:-$(date +%Y.%m.%d)}"

# Version handling with validation
if [ -n "$1" ]; then
VERSION="$1"
# Validate semantic version format (v1.2.3) or date format (YYYY.MM.DD)
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]] && \
[[ ! "$VERSION" =~ ^[0-9]{4}\.[0-9]{2}\.[0-9]{2}$ ]]; then
echo "ERROR: Invalid version format: $VERSION"
echo "Expected: v1.2.3, v1.2.3-beta, or YYYY.MM.DD"
Comment on lines +14 to +18
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern for pre-release versions allows alphanumeric characters with a single hyphen prefix (e.g., v1.2.3-beta), but according to semantic versioning specification, pre-release versions can have multiple dot-separated identifiers (e.g., v1.2.3-beta.1, v1.2.3-rc.2). The current pattern should be updated to: ^v[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z0-9]+(.[a-zA-Z0-9]+)*)?$ to fully comply with semver.

Suggested change
# Validate semantic version format (v1.2.3) or date format (YYYY.MM.DD)
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]] && \
[[ ! "$VERSION" =~ ^[0-9]{4}\.[0-9]{2}\.[0-9]{2}$ ]]; then
echo "ERROR: Invalid version format: $VERSION"
echo "Expected: v1.2.3, v1.2.3-beta, or YYYY.MM.DD"
# Validate semantic version format (v1.2.3, v1.2.3-beta.1, etc.) or date format (YYYY.MM.DD)
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*)?$ ]] && \
[[ ! "$VERSION" =~ ^[0-9]{4}\.[0-9]{2}\.[0-9]{2}$ ]]; then
echo "ERROR: Invalid version format: $VERSION"
echo "Expected: v1.2.3, v1.2.3-beta, v1.2.3-beta.1, or YYYY.MM.DD"

Copilot uses AI. Check for mistakes.
exit 1
fi
else
VERSION="$(date +%Y.%m.%d)"
fi

RELEASE_DIR="$SCRIPT_DIR/release"
RELEASE_NAME="SledLink-$VERSION"
OUTPUT_DIR="$RELEASE_DIR/$RELEASE_NAME"
Expand Down Expand Up @@ -105,12 +119,19 @@ cp "$SCRIPT_DIR/UPLOAD_GUIDE.md" "$OUTPUT_DIR/"
cp "$SCRIPT_DIR/docs/README.md" "$OUTPUT_DIR/docs_README.md" 2>/dev/null || true

# Create release README
cat > "$OUTPUT_DIR/README.txt" << 'HEREDOC'
cat > "$OUTPUT_DIR/README.txt" << HEREDOC
================================================================================
SledLink Firmware Release
SledLink Firmware Release $VERSION
Tractor Pull Distance Measurement System
================================================================================

RELEASE INFORMATION
-------------------
Version: $VERSION
Firmware: v1.0.0
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded firmware version "v1.0.0" in the README template doesn't match the actual FIRMWARE_DISPLAY_VERSION defined in the Arduino controller files, which is also "v1.0.0". While currently matching, this creates a maintenance burden as it needs to be manually kept in sync. Consider reading the firmware version from the source files or documenting that this needs to be updated when the firmware version changes.

Suggested change
Firmware: v1.0.0
Firmware: $VERSION

Copilot uses AI. Check for mistakes.
Build Date: $(date +%Y-%m-%d)
Download: https://github.com/thompcd/SledLink/releases/tag/$VERSION

This release contains pre-compiled firmware and tools for the SledLink system.

CONTENTS
Expand Down
Loading