bi-monthly release #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: bi-monthly release | |
| on: | |
| schedule: | |
| - cron: '0 0 1 2,4,6,8,10,12 *' # Runs at 00:00 on the 1st of every second month | |
| workflow_dispatch: | |
| jobs: | |
| release: | |
| runs-on: windows-latest | |
| permissions: | |
| contents: write | |
| defaults: | |
| run: | |
| shell: pwsh | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Check for commits in the last 60 days | |
| run: | | |
| git fetch origin master | |
| COMMITS=$(git rev-list --count --since="60 days ago" origin/master) | |
| echo "Commits in last 60 days: $COMMITS" | |
| if [ "$COMMITS" -lt 3 ]; then | |
| echo "$COMMITS commits in the last 60 days. Skipping release." | |
| exit 0 | |
| fi | |
| shell: bash | |
| - name: Build OSCR Release | |
| run: | | |
| #Requires -Version 5.1 | |
| Set-StrictMode -Version Latest | |
| $ErrorActionPreference = "Stop" | |
| function Get-FileWithProgress { | |
| param ( | |
| [Parameter(Mandatory = $true)][string]$Url, | |
| [Parameter(Mandatory = $true)][string]$Destination | |
| ) | |
| Add-Type -AssemblyName System.Net.Http | |
| Write-Host "Downloading: $Url" | |
| $client = New-Object System.Net.Http.HttpClient | |
| $response = $client.GetAsync($Url, [System.Net.Http.HttpCompletionOption]::ResponseHeadersRead).Result | |
| $total = $response.Content.Headers.ContentLength | |
| $stream = $response.Content.ReadAsStreamAsync().Result | |
| $fileStream = [System.IO.File]::OpenWrite($Destination) | |
| $buffer = New-Object byte[] 8192 | |
| $read = 0 | |
| $totalRead = 0 | |
| $lastPercent = -1 | |
| do { | |
| $read = $stream.Read($buffer, 0, $buffer.Length) | |
| if ($read -gt 0) { | |
| $fileStream.Write($buffer, 0, $read) | |
| $totalRead += $read | |
| if ($total) { | |
| $percent = [math]::Floor(($totalRead / $total) * 100) | |
| if ($percent -ne $lastPercent) { | |
| Write-Progress -Activity "Downloading" -Status "$percent% complete" -PercentComplete $percent | |
| $lastPercent = $percent | |
| } | |
| } | |
| } | |
| } while ($read -gt 0) | |
| $fileStream.Close() | |
| $stream.Close() | |
| Write-Progress -Activity "Downloading" -Completed | |
| Write-Host "Download complete: $Destination" | |
| } | |
| function Expand-Zip { | |
| param ( | |
| [string]$ZipPath, | |
| [string]$OutPath | |
| ) | |
| Expand-Archive -Path $ZipPath -DestinationPath $OutPath -Force | |
| } | |
| $root = Join-Path (Get-Location) "oscr_release" | |
| if (Test-Path $root) { | |
| Remove-Item $root -Recurse -Force | |
| } | |
| New-Item -ItemType Directory -Path $root | Out-Null | |
| Set-Location $root | |
| # Check if Arduino IDE folder exists to skip Steps 1-3 | |
| if (Test-Path "$root\Arduino IDE") { | |
| Write-Host "Arduino IDE folder already exists. Skipping Steps 1, 2, 3." | |
| } else { | |
| ### Step 1: Arduino IDE ### | |
| Write-Host "Step 1: Downloading Arduino IDE..." -ForegroundColor Green | |
| $ideZip = Join-Path $root "arduino-1.8.19-windows.zip" | |
| Get-FileWithProgress -Url "https://downloads.arduino.cc/arduino-1.8.19-windows.zip" -Destination $ideZip | |
| Write-Host "Verifying SHA256..." | |
| $expectedHash = "C704A821089EAB2588F1DEAE775916219B1517FEBD1DD574FF29958DCA873945" | |
| $hash = (Get-FileHash $ideZip -Algorithm SHA256).Hash | |
| if ($hash -ne $expectedHash) { | |
| Write-Error "Checksum mismatch! Aborting." | |
| exit 1 | |
| } else { | |
| Write-Host "Checksum OK." | |
| } | |
| Write-Host "Extracting Arduino IDE..." | |
| Expand-Zip -ZipPath $ideZip -OutPath $root | |
| Remove-Item $ideZip | |
| Rename-Item -Path "$root\arduino-1.8.19" -NewName "Arduino IDE" | |
| ### Step 2: Update AVR-GCC compiler ### | |
| Write-Host "Step 2: Downloading latest AVR-GCC compiler..." -ForegroundColor Green | |
| $avrGccZip = Join-Path $root "avr-gcc-14.1.0-x64-windows.zip" | |
| Get-FileWithProgress -Url "https://github.com/ZakKemble/avr-gcc-build/releases/download/v15.2.0-1/avr-gcc-15.2.0-x64-windows.zip" -Destination $avrGccZip | |
| Write-Host "Verifying AVR-GCC SHA256..." | |
| $expectedAvrHash = "3bcfdbdbff6e3576ef0bef9e119b16f7012657d30f002d6d9d4848a7efd4f8b7" | |
| $avrHash = (Get-FileHash $avrGccZip -Algorithm SHA256).Hash | |
| if ($avrHash -ne $expectedAvrHash) { | |
| Write-Error "AVR-GCC checksum mismatch! Aborting." | |
| exit 1 | |
| } else { | |
| Write-Host "AVR-GCC checksum OK." | |
| } | |
| # Extract new AVR-GCC | |
| Write-Host "Extracting AVR-GCC..." | |
| Expand-Zip -ZipPath $avrGccZip -OutPath "$root\temp_avr" | |
| Remove-Item $avrGccZip | |
| # Replace old AVR folder with new one | |
| $toolsPath = "$root\Arduino IDE\hardware\tools" | |
| $oldAvrPath = "$toolsPath\avr" | |
| $backupAvrPath = "$root\avr_backup" | |
| if (Test-Path $oldAvrPath) { | |
| Write-Host "Backing up old AVR compiler..." | |
| # Remove existing backup if it exists | |
| if (Test-Path $backupAvrPath) { | |
| Remove-Item $backupAvrPath -Recurse -Force | |
| } | |
| Move-Item $oldAvrPath $backupAvrPath | |
| } | |
| # Move new AVR-GCC to tools folder | |
| Write-Host "Installing new AVR-GCC compiler..." | |
| Move-Item "$root\temp_avr\avr-gcc-15.2.0-x64-windows" "$toolsPath\avr" | |
| # Copy essential files from old AVR installation if backup exists | |
| if (Test-Path $backupAvrPath) { | |
| Write-Host "Copying essential files from old AVR installation..." | |
| # Copy avrdude.exe if it exists | |
| $oldAvrdude = "$backupAvrPath\bin\avrdude.exe" | |
| $newAvrdudeDir = "$toolsPath\avr\bin" | |
| if (Test-Path $oldAvrdude) { | |
| Copy-Item $oldAvrdude $newAvrdudeDir -Force | |
| Write-Host "Copied avrdude.exe" | |
| } | |
| # Copy old libusb0.dll | |
| $oldLibusb = "$backupAvrPath\bin\libusb0.dll" | |
| if (Test-Path $oldLibusb) { | |
| Copy-Item $oldLibusb $newAvrdudeDir -Force | |
| Write-Host "Copied libusb0.dll" | |
| } | |
| # Delete new avrdude.conf | |
| Remove-Item "$toolsPath\avr\bin\avrdude.conf" | |
| # Copy builtin_tools_versions.txt if it exists | |
| $oldVersions = "$backupAvrPath\builtin_tools_versions.txt" | |
| $newAvrDir = "$toolsPath\avr" | |
| if (Test-Path $oldVersions) { | |
| Copy-Item $oldVersions $newAvrDir -Force | |
| Write-Host "Copied builtin_tools_versions.txt" | |
| } | |
| # Copy etc folder if it exists | |
| $oldEtc = "$backupAvrPath\etc" | |
| $newAvrDir = "$toolsPath\avr" | |
| if (Test-Path $oldEtc) { | |
| Copy-Item $oldEtc $newAvrDir -Recurse -Force | |
| Write-Host "Copied etc folder" | |
| } | |
| } | |
| # Clean up temporary files | |
| Remove-Item "$root\temp_avr" -Recurse -Force | |
| Remove-Item "$root\avr_backup" -Recurse -Force | |
| ### Step 3: Update AVRDUDE ### | |
| if ($true) { | |
| # New avrdude might have bugs, add option to skip | |
| Write-Host "Skipping Step 3: Updating AVRDUDE..." -ForegroundColor Green | |
| } else { | |
| Write-Host "Step 3: Updating AVRDUDE..." -ForegroundColor Green | |
| $avrdudeZip = Join-Path $root "avrdude-v8.1-windows-x64.zip" | |
| $avrdudeBinPath = "$root\Arduino IDE\hardware\tools\avr\bin" | |
| $avrdudeEtcPath = "$root\Arduino IDE\hardware\tools\avr\etc" | |
| $avrdudeExePath = Join-Path $avrdudeBinPath "avrdude.exe" | |
| $avrdudeConfPath = Join-Path $avrdudeEtcPath "avrdude.conf" | |
| Write-Host "Downloading AVRDUDE..." | |
| Get-FileWithProgress -Url "https://github.com/avrdudes/avrdude/releases/download/v8.1/avrdude-v8.1-windows-x64.zip" -Destination $avrdudeZip | |
| Write-Host "Verifying AVRDUDE SHA256..." | |
| $expectedAvrdudeHash = "e4d571d81fee3387d51bfdedd0b6565e4c201e974101cac2caec7adfd6201da3" | |
| $avrdudeHash = (Get-FileHash $avrdudeZip -Algorithm SHA256).Hash | |
| if ($avrdudeHash -ne $expectedAvrdudeHash) { | |
| Write-Error "AVRDUDE checksum mismatch! Aborting." | |
| exit 1 | |
| } else { | |
| Write-Host "AVRDUDE checksum OK." | |
| } | |
| Write-Host "Extracting AVRDUDE..." | |
| $tempAvrdudeDir = "$root\temp_avrdude" | |
| Expand-Zip -ZipPath $avrdudeZip -OutPath $tempAvrdudeDir | |
| Remove-Item $avrdudeZip | |
| # Ensure target directories exist | |
| if (-not (Test-Path $avrdudeBinPath)) { | |
| New-Item -ItemType Directory -Path $avrdudeBinPath -Force | |
| } | |
| if (-not (Test-Path $avrdudeEtcPath)) { | |
| New-Item -ItemType Directory -Path $avrdudeEtcPath -Force | |
| } | |
| # Find the extracted avrdude files and copy them | |
| $extractedAvrdudeExe = Get-ChildItem -Path $tempAvrdudeDir -Name "avrdude.exe" -Recurse | Select-Object -First 1 | |
| $extractedAvrdudeConf = Get-ChildItem -Path $tempAvrdudeDir -Name "avrdude.conf" -Recurse | Select-Object -First 1 | |
| if ($extractedAvrdudeExe) { | |
| $fullAvrdudeExePath = Join-Path $tempAvrdudeDir $extractedAvrdudeExe | |
| Write-Host "Installing avrdude.exe to $avrdudeBinPath" | |
| Copy-Item $fullAvrdudeExePath $avrdudeExePath -Force | |
| } else { | |
| Write-Error "Could not find avrdude.exe in extracted files!" | |
| } | |
| if ($extractedAvrdudeConf) { | |
| $fullAvrdudeConfPath = Join-Path $tempAvrdudeDir $extractedAvrdudeConf | |
| Write-Host "Installing avrdude.conf to $avrdudeEtcPath" | |
| Copy-Item $fullAvrdudeConfPath $avrdudeConfPath -Force | |
| } else { | |
| Write-Error "Could not find avrdude.conf in extracted files!" | |
| } | |
| # Clean up temporary files | |
| Remove-Item $tempAvrdudeDir -Recurse -Force | |
| Write-Host "AVRDUDE v8.0 installation complete!" | |
| } | |
| } | |
| # Step 4: Arduino CLI Setup | |
| Write-Host "Step 4: Setting up Arduino CLI..." -ForegroundColor Green | |
| # Make sure libraries folder exists | |
| New-Item -ItemType Directory -Path "$root\Arduino IDE\portable\sketchbook\libraries" -Force | Out-Null | |
| $arduinoCliZip = Join-Path $root "arduino-cli_1.2.2_Windows_64bit.zip" | |
| $arduinoCliExe = Join-Path $root "Arduino IDE\arduino-cli.exe" | |
| # Download arduino-cli if not already present | |
| if (-not (Test-Path $arduinoCliExe)) { | |
| Write-Host "Downloading Arduino CLI..." | |
| Get-FileWithProgress -Url "https://github.com/arduino/arduino-cli/releases/download/v1.2.2/arduino-cli_1.2.2_Windows_64bit.zip" -Destination $arduinoCliZip | |
| Write-Host "Verifying Arduino CLI SHA256..." | |
| $expectedCliHash = "bdd3ed88a361af8539e51a1cc0bf831b269be155ddfdd90cb96a900ce78723b7" | |
| $cliHash = (Get-FileHash $arduinoCliZip -Algorithm SHA256).Hash | |
| if ($cliHash -ne $expectedCliHash) { | |
| Write-Error "Arduino CLI checksum mismatch! Aborting." | |
| exit 1 | |
| } else { | |
| Write-Host "Arduino CLI checksum OK." | |
| } | |
| Write-Host "Extracting Arduino CLI..." | |
| Expand-Zip -ZipPath $arduinoCliZip -OutPath "$root\temp_cli" | |
| Remove-Item $arduinoCliZip | |
| # Move arduino-cli.exe to Arduino IDE directory | |
| Move-Item "$root\temp_cli\arduino-cli.exe" $arduinoCliExe | |
| Remove-Item "$root\temp_cli" -Recurse -Force | |
| } else { | |
| Write-Host "Arduino CLI already exists, skipping download." | |
| } | |
| # Configure Arduino CLI for portable mode | |
| Write-Host "Configuring Arduino CLI for portable mode..." | |
| Set-Location "$root\Arduino IDE" | |
| # Initialize configuration | |
| & ".\arduino-cli.exe" config init | |
| # Set portable sketchbook directory | |
| & ".\arduino-cli.exe" config set directories.user "portable\sketchbook" | |
| # Update package index | |
| Write-Host "Updating Arduino CLI package index..." | |
| & ".\arduino-cli.exe" core update-index | |
| # Step 5: Install Required Libraries | |
| Write-Host "Step 5: Installing required libraries..." -ForegroundColor Green | |
| $libraries = @( | |
| "SdFat", | |
| "Adafruit BusIO", | |
| "U8g2", | |
| "Adafruit NeoPixel", | |
| "RotaryEncoder", | |
| "Etherkit Si5351", | |
| "RTClib", | |
| "FreqCount" | |
| ) | |
| foreach ($lib in $libraries) { | |
| Write-Host "Installing library: $lib" | |
| try { | |
| & ".\arduino-cli.exe" lib install $lib | |
| Write-Host "Successfully installed: $lib" | |
| } catch { | |
| Write-Warning "Failed to install library: $lib - $($_.Exception.Message)" | |
| } | |
| } | |
| # Update all libraries | |
| Write-Host "Updating library index..." | |
| & ".\arduino-cli.exe" lib update-index | |
| Write-Host "Upgrading all libraries..." | |
| & ".\arduino-cli.exe" lib upgrade | |
| Write-Host "Arduino CLI setup and library installation complete!" | |
| # Return to original directory | |
| Set-Location $root | |
| ### Step 6: OSCR Sketch ### | |
| Write-Host "Step 6: Downloading OSCR sketch..." -ForegroundColor Green | |
| $sketchZip = Join-Path $root "master.zip" | |
| Get-FileWithProgress -Url "https://github.com/sanni/cartreader/archive/refs/heads/master.zip" -Destination $sketchZip | |
| Expand-Zip -ZipPath $sketchZip -OutPath $root | |
| Remove-Item $sketchZip | |
| $sketchRoot = Join-Path $root "cartreader-master" | |
| # Delete existing Cart_Reader folder if it exists before moving the new one | |
| $cartReaderDest = "$root\Arduino IDE\portable\sketchbook\Cart_Reader" | |
| if (Test-Path $cartReaderDest) { | |
| Write-Host "Existing Cart_Reader folder found. Removing..." | |
| Remove-Item $cartReaderDest -Recurse -Force | |
| } | |
| # Delete existing SD Card folder if it exists before moving | |
| $sdCardDest = "$root\SD Card" | |
| if (Test-Path $sdCardDest) { | |
| Write-Host "Existing SD Card folder found. Removing..." | |
| Remove-Item $sdCardDest -Recurse -Force | |
| } | |
| Move-Item "$sketchRoot\Cart_Reader" $cartReaderDest | |
| Move-Item "$sketchRoot\sd" $sdCardDest | |
| Move-Item "$sketchRoot\LICENSE" "$root\LICENSE.txt" -Force | |
| Move-Item "$sketchRoot\tools\oscr_tool\launch_oscr_tool.bat" "$root" -Force | |
| Move-Item "$sketchRoot\tools\oscr_tool\oscr_tool.ps1" "$root" -Force | |
| Remove-Item "$sdCardDest\README.md","$cartReaderDest\README.md","$cartReaderDest\LICENSE.txt" -ErrorAction SilentlyContinue | |
| Remove-Item "$sketchRoot" -Recurse -Force | |
| ### Step 7: CH341 Drivers ### | |
| Write-Host "Step 7: Downloading CH341 driver..." -ForegroundColor Green | |
| # Delete existing CH341 Drivers folder if it exists before moving | |
| $CH341Dest = "$root\CH341 Drivers" | |
| if (Test-Path $CH341Dest) { | |
| Write-Host "Existing CH341 Drivers folder found. Removing..." | |
| Remove-Item $CH341Dest -Recurse -Force | |
| } | |
| $drvZip = Join-Path $root "drivers.zip" | |
| Get-FileWithProgress -Url "https://www.wch-ic.com/download/file?id=5" -Destination $drvZip | |
| Write-Host "Verifying SHA256..." | |
| $expectedHash = "a7b08baaaf9b0e8548ffbab2a91fab8c75595f8d63a42a490fbf3fd1e747e21c" | |
| $hash = (Get-FileHash $drvZip -Algorithm SHA256).Hash | |
| if ($hash -ne $expectedHash) { | |
| Write-Error "Checksum mismatch! Aborting." | |
| exit 1 | |
| } else { | |
| Write-Host "Checksum OK." | |
| } | |
| Expand-Zip -ZipPath $drvZip -OutPath "$root\drivers" | |
| Move-Item "$root\drivers\CH341SER" "$root\CH341 Drivers" -Force | |
| Remove-Item "$root\drivers" -Recurse -Force | |
| Remove-Item $drvZip -Force | |
| ### Step 8: Optimize U8g2 ### | |
| Write-Host "Step 8: Optimizing U8g2 for size..." -ForegroundColor Green | |
| $u8g2Header = "$root\Arduino IDE\portable\sketchbook\libraries\U8g2\src\clib\u8g2.h" | |
| (Get-Content $u8g2Header) ` | |
| -replace '#define U8G2_16BIT', '//#define U8G2_16BIT' ` | |
| -replace '#define U8G2_WITH_HVLINE_SPEED_OPTIMIZATION', '//#define U8G2_WITH_HVLINE_SPEED_OPTIMIZATION' ` | |
| -replace '#define U8G2_WITH_INTERSECTION', '//#define U8G2_WITH_INTERSECTION' ` | |
| -replace '#define U8G2_WITH_CLIP_WINDOW_SUPPORT', '//#define U8G2_WITH_CLIP_WINDOW_SUPPORT' ` | |
| -replace '#define U8G2_WITH_FONT_ROTATION', '//#define U8G2_WITH_FONT_ROTATION' ` | |
| -replace '#define U8G2_WITH_UNICODE', '//#define U8G2_WITH_UNICODE' | | |
| Set-Content -Encoding ASCII $u8g2Header | |
| Write-Host "DONE. Portable Arduino IDE for OSCR with updated AVR-GCC compiler is ready." | |
| ### Step 9: README ### | |
| Write-Host "Step 9: Creating README.txt..." | |
| @" | |
| 1) Install CH341 Drivers by running SETUP.exe in the "CH341 Drivers" folder | |
| 2) Launch arduino.exe found in the "Arduino IDE" directory | |
| 3) In the Arduino IDE go File -> Sketchbook -> Cart_Reader | |
| 4) Then Tools -> Board and select "Arduino/Genuino Mega or Mega 2560" | |
| 5) Followed by Tools -> Port and select your Arduino | |
| 6) In Config.h define your HW version by removing // in front of "#define HWX" where X is your hardware version | |
| 7) Next Sketch -> Upload | |
| 8) Verify that the upload didn't give you any errors | |
| 9) Copy the content of the "SD Card" folder to the root of your SD card | |
| 10) Mark the *.txt files as hidden | |
| More info: https://github.com/sanni/cartreader/wiki | |
| "@ | Set-Content -Encoding UTF8 -Path "$root\README.txt" | |
| ### Step 10: Extracting version from OSCR.cpp ### | |
| Write-Host "Step 10: Extracting version from OSCR.cpp..." | |
| $pattern = 'FSTRING_VERSION\[\] = "(.*)";' | |
| $cppPath = Join-Path $root "Arduino IDE\portable\sketchbook\Cart_Reader\OSCR.cpp" | |
| $line = Select-String -Path $cppPath -Pattern $pattern | Select-Object -First 1 | |
| if (-not $line) { | |
| throw "Version string not found in OSCR.cpp" | |
| } | |
| $version = [regex]::Match($line.Line, $pattern).Groups[1].Value | |
| Write-Host "Extracted version: $version" | |
| # Write version to GitHub Actions environment | |
| $githubEnv = $env:GITHUB_ENV | |
| if (-not $githubEnv) { | |
| throw "`$GITHUB_ENV is not set. Are you running this inside GitHub Actions?" | |
| } | |
| Add-Content -Path $githubEnv -Value "OSCR_VERSION=$version" | |
| ### Step 11: Create zip ### | |
| Write-Host "Step 11: Create zip..." | |
| # Go up one directory | |
| Set-Location (Split-Path $root -Parent) | |
| # Define release folder name | |
| $releaseFolder = "${version}_Portable" | |
| # Remove old folder if it exists | |
| if (Test-Path $releaseFolder) { | |
| Remove-Item $releaseFolder -Recurse -Force | |
| } | |
| # Rename oscr_release to versioned folder | |
| Rename-Item -Path "oscr_release" -NewName $releaseFolder | |
| # Create zip archive | |
| Compress-Archive -Path $releaseFolder -DestinationPath "$releaseFolder.zip" | |
| # Create 7zip archive | |
| & "C:\Program Files\7-Zip\7z.exe" a "$releaseFolder.7z" "$releaseFolder" | |
| # Clean up folder after zipping | |
| if (Test-Path $releaseFolder) { | |
| Remove-Item $releaseFolder -Recurse -Force | |
| } | |
| Write-Host "DONE. Portable Arduino IDE for OSCR is ready." | |
| - name: Publish GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.OSCR_VERSION }} | |
| name: ${{ env.OSCR_VERSION }} | |
| body: Automated bi-monthly OSCR release | |
| files: | | |
| ${{ env.OSCR_VERSION }}_Portable.zip | |
| ${{ env.OSCR_VERSION }}_Portable.7z | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Sparse checkout OSCR.cpp | |
| run: | | |
| git init bump-temp | |
| cd bump-temp | |
| git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
| git config core.sparseCheckout true | |
| echo Cart_Reader/OSCR.cpp > .git/info/sparse-checkout | |
| git pull origin master | |
| shell: bash | |
| - name: Bump version in OSCR.cpp and push | |
| run: | | |
| cd bump-temp/Cart_Reader | |
| # Extract current version numbers | |
| OLD_VERSION=$(grep 'FSTRING_VERSION' OSCR.cpp | sed -E 's/.*"V([0-9]+)\.([0-9]+)".*/\1 \2/') | |
| MAJOR=$(echo $OLD_VERSION | cut -d' ' -f1) | |
| MINOR=$(echo $OLD_VERSION | cut -d' ' -f2) | |
| # Increment version according to your scheme | |
| if [ "$MINOR" -lt 9 ]; then | |
| MINOR=$((MINOR + 1)) | |
| else | |
| MINOR=0 | |
| MAJOR=$((MAJOR + 1)) | |
| fi | |
| NEW_VERSION="V${MAJOR}.${MINOR}" | |
| # Replace version in OSCR.cpp | |
| sed -i -E "s/(FSTRING_VERSION\\[\\] = \")V[0-9]+\\.[0-9]+(\";)/\1${NEW_VERSION}\2/" OSCR.cpp | |
| # Commit & push changes | |
| cd .. | |
| git config user.name "github-actions" | |
| git config user.email "[email protected]" | |
| git add Cart_Reader/OSCR.cpp | |
| git commit -m "Bump version to ${NEW_VERSION} after bi-monthly release" | |
| git push origin HEAD:master | |
| shell: bash |