File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Version Check 
2+ 
3+ on :
4+   push :
5+     branches : [ master ] 
6+     paths :
7+       - ' src/NoteDefines.h' 
8+       - ' library.properties' 
9+   pull_request :
10+     branches : [ master ] 
11+     paths :
12+       - ' src/NoteDefines.h' 
13+       - ' library.properties' 
14+   workflow_dispatch :
15+ 
16+ jobs :
17+   check-version :
18+     runs-on : ubuntu-latest 
19+     steps :
20+       - name : Checkout code 
21+         uses : actions/checkout@v3 
22+ 
23+       - name : Check version consistency 
24+         run : | 
25+           chmod +x scripts/check_version.sh 
26+           ./scripts/check_version.sh 
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set  -e
3+ 
4+ #  Script to check that the version in src/NoteDefines.h matches the version in library.properties
5+ #  Usage: ./check_version.sh
6+ 
7+ #  Get the version from library.properties
8+ LIBRARY_VERSION=$( grep " ^version="   library.properties |  cut -d= -f2) 
9+ 
10+ #  Get the version components from NoteDefines.h
11+ MAJOR=$( grep " NOTE_ARDUINO_VERSION_MAJOR"   src/NoteDefines.h |  grep -o " [0-9]\+" ) 
12+ MINOR=$( grep " NOTE_ARDUINO_VERSION_MINOR"   src/NoteDefines.h |  grep -o " [0-9]\+" ) 
13+ PATCH=$( grep " NOTE_ARDUINO_VERSION_PATCH"   src/NoteDefines.h |  grep -o " [0-9]\+" ) 
14+ 
15+ #  Construct the version string from the components
16+ DEFINES_VERSION=" $MAJOR .$MINOR .$PATCH " 
17+ 
18+ echo  " Version in library.properties: $LIBRARY_VERSION " 
19+ echo  " Version in src/NoteDefines.h: $DEFINES_VERSION " 
20+ 
21+ #  Compare the versions
22+ if  [ " $LIBRARY_VERSION "   =  " $DEFINES_VERSION "   ];  then 
23+     echo  " ✅ Versions match!" 
24+     exit  0
25+ else 
26+     echo  " ❌ Version mismatch!" 
27+     echo  " library.properties version: $LIBRARY_VERSION " 
28+     echo  " src/NoteDefines.h version: $DEFINES_VERSION " 
29+     exit  1
30+ fi 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments