Skip to content

Test #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Test #138

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
26 changes: 26 additions & 0 deletions .github/workflows/version-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Version Check

on:
push:
branches: [ master ]
paths:
- 'src/NoteDefines.h'
- 'library.properties'
pull_request:
branches: [ master ]
paths:
- 'src/NoteDefines.h'
- 'library.properties'
workflow_dispatch:

jobs:
check-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Check version consistency
run: |
chmod +x scripts/check_version.sh
./scripts/check_version.sh
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Blues Wireless Notecard
version=1.6.4
version=2.6.4
author=Blues
maintainer=Blues <[email protected]>
sentence=An easy to use Notecard Library for Arduino.
Expand Down
30 changes: 30 additions & 0 deletions scripts/check_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -e

# Script to check that the version in src/NoteDefines.h matches the version in library.properties
# Usage: ./check_version.sh

# Get the version from library.properties
LIBRARY_VERSION=$(grep "^version=" library.properties | cut -d= -f2)

# Get the version components from NoteDefines.h
MAJOR=$(grep "NOTE_ARDUINO_VERSION_MAJOR" src/NoteDefines.h | grep -o "[0-9]\+")
MINOR=$(grep "NOTE_ARDUINO_VERSION_MINOR" src/NoteDefines.h | grep -o "[0-9]\+")
PATCH=$(grep "NOTE_ARDUINO_VERSION_PATCH" src/NoteDefines.h | grep -o "[0-9]\+")

# Construct the version string from the components
DEFINES_VERSION="$MAJOR.$MINOR.$PATCH"

echo "Version in library.properties: $LIBRARY_VERSION"
echo "Version in src/NoteDefines.h: $DEFINES_VERSION"

# Compare the versions
if [ "$LIBRARY_VERSION" = "$DEFINES_VERSION" ]; then
echo "✅ Versions match!"
exit 0
else
echo "❌ Version mismatch!"
echo "library.properties version: $LIBRARY_VERSION"
echo "src/NoteDefines.h version: $DEFINES_VERSION"
exit 1
fi
Loading