From de49b6fd4a4e8508dea182e302b31e6bf4e889cf Mon Sep 17 00:00:00 2001 From: danemadsen Date: Tue, 9 Jul 2024 11:56:04 +1000 Subject: [PATCH] scripts --- .github/workflows/build-android.yml | 3 +++ .github/workflows/build-linux.yml | 5 ++++- .github/workflows/build-macos.yml | 5 ++++- .github/workflows/build-windows.yml | 3 +++ pubspec.yaml | 2 +- {.github/scripts => scripts}/create_appimage.sh | 0 {.github/scripts => scripts}/create_dmg.sh | 0 setup_flutter.bat => scripts/setup_flutter.bat | 2 +- setup_flutter.sh => scripts/setup_flutter.sh | 2 +- scripts/update_build_number.bat | 6 ++++++ {.github/scripts => scripts}/update_build_number.sh | 2 +- 11 files changed, 24 insertions(+), 6 deletions(-) rename {.github/scripts => scripts}/create_appimage.sh (100%) rename {.github/scripts => scripts}/create_dmg.sh (100%) rename setup_flutter.bat => scripts/setup_flutter.bat (76%) rename setup_flutter.sh => scripts/setup_flutter.sh (76%) create mode 100644 scripts/update_build_number.bat rename {.github/scripts => scripts}/update_build_number.sh (64%) diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 5d2821bdb..c0485a6ad 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -26,6 +26,9 @@ jobs: with: flutter-version: '3.22.2' + - name: Update Build Number + run: ./scripts/update_build_number.sh + - name: Decode Keystore File env: KEYSTORE: ${{ secrets.KEYSTORE }} diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 13ecd9c5f..da4772bdd 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -19,6 +19,9 @@ jobs: uses: subosito/flutter-action@v2 with: flutter-version: '3.22.2' + + - name: Update Build Number + run: ./scripts/update_build_number.sh - name: Install dependencies run: | @@ -61,7 +64,7 @@ jobs: sudo mv appimagetool-x86_64.AppImage /usr/local/bin/appimagetool - name: Create AppImage - run: ./.github/scripts/create_appimage.sh + run: ./scripts/create_appimage.sh - name: Upload AppImage uses: actions/upload-artifact@v4 diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 14875616b..abc74c7fe 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -24,6 +24,9 @@ jobs: with: flutter-version: '3.22.2' + - name: Update Build Number + run: ./scripts/update_build_number.sh + - name: Install Apple Certificate uses: apple-actions/import-codesign-certs@v1 with: @@ -63,7 +66,7 @@ jobs: xcrun stapler staple "build/macos/Build/Products/Release/maid.app" - name: Create DMG - run: ./.github/scripts/create_dmg.sh + run: ./scripts/create_dmg.sh - name: Upload macOS Build uses: actions/upload-artifact@v4 diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index eb10c4b14..b36607497 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -19,6 +19,9 @@ jobs: uses: subosito/flutter-action@v2 with: flutter-version: '3.22.2' + + - name: Update Build Number + run: ./scripts/update_build_number.bat - name: Install dependencies run: | diff --git a/pubspec.yaml b/pubspec.yaml index 2f64f529c..379744999 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.2.9+1697 +version: 1.2.9+1707 environment: sdk: '>=3.0.0 <4.0.0' diff --git a/.github/scripts/create_appimage.sh b/scripts/create_appimage.sh similarity index 100% rename from .github/scripts/create_appimage.sh rename to scripts/create_appimage.sh diff --git a/.github/scripts/create_dmg.sh b/scripts/create_dmg.sh similarity index 100% rename from .github/scripts/create_dmg.sh rename to scripts/create_dmg.sh diff --git a/setup_flutter.bat b/scripts/setup_flutter.bat similarity index 76% rename from setup_flutter.bat rename to scripts/setup_flutter.bat index c7c3569ae..986b46894 100644 --- a/setup_flutter.bat +++ b/scripts/setup_flutter.bat @@ -4,7 +4,7 @@ set "script_dir=%~dp0" :: Remove trailing backslash -set "flutter_path=%script_dir:~0,-1%\packages\flutter\bin" +set "flutter_path=%script_dir:~0,-1%\..\packages\flutter\bin" :: Add Flutter to the PATH set PATH=%flutter_path%;%PATH% diff --git a/setup_flutter.sh b/scripts/setup_flutter.sh similarity index 76% rename from setup_flutter.sh rename to scripts/setup_flutter.sh index 65b784950..969f972e0 100755 --- a/setup_flutter.sh +++ b/scripts/setup_flutter.sh @@ -6,4 +6,4 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Add Flutter to the PATH export PATH="$DIR/packages/flutter/bin:$PATH" -echo "Flutter path set to $DIR/packages/flutter/bin" +echo "Flutter path set to $DIR/../packages/flutter/bin" diff --git a/scripts/update_build_number.bat b/scripts/update_build_number.bat new file mode 100644 index 000000000..27e9ca2c4 --- /dev/null +++ b/scripts/update_build_number.bat @@ -0,0 +1,6 @@ +@echo off +:: Get the number of commits +for /f %%i in ('git rev-list --count HEAD') do set commit_count=%%i + +:: Update the pubspec.yaml file with the new build number +powershell -Command "(gc ../pubspec.yaml) -replace 'version: (.*)\+.*', 'version: $1+%commit_count%' | Out-File -encoding ASCII ../pubspec.yaml" diff --git a/.github/scripts/update_build_number.sh b/scripts/update_build_number.sh similarity index 64% rename from .github/scripts/update_build_number.sh rename to scripts/update_build_number.sh index a825324e6..ffd706473 100755 --- a/.github/scripts/update_build_number.sh +++ b/scripts/update_build_number.sh @@ -4,4 +4,4 @@ commit_count=$(git rev-list --count HEAD) # Update the pubspec.yaml file with the new build number -sed -i '' "s/version: \(.*\)+.*/version: \1+$commit_count/" ../../pubspec.yaml \ No newline at end of file +sed -i '' "s/version: \(.*\)+.*/version: \1+$commit_count/" ../pubspec.yaml \ No newline at end of file