From 55bc97a4d876270b80dc89f44f6448ca698c1295 Mon Sep 17 00:00:00 2001 From: Anashuman Singh Date: Thu, 30 Jan 2025 22:40:25 +0530 Subject: [PATCH] chore: setup release infrastructure --- .github/actions/screenshot-android/action.yml | 19 +++++++++ .github/actions/screenshot-ios/action.yml | 27 ++++++++++++ .github/workflows/release.yml | 42 +++++++++++++------ README.md | 19 ++++++--- test_integration/test_driver.dart | 3 +- 5 files changed, 90 insertions(+), 20 deletions(-) diff --git a/.github/actions/screenshot-android/action.yml b/.github/actions/screenshot-android/action.yml index 1061ca12b..b5e81d9f2 100644 --- a/.github/actions/screenshot-android/action.yml +++ b/.github/actions/screenshot-android/action.yml @@ -67,6 +67,25 @@ runs: script: | flutter drive --driver=test_integration/test_driver.dart --target=test_integration/screenshots.dart -d emulator + - name: Update Fastlane Metadata + if: ${{ github.event_name != 'pull_request' }} + shell: bash + run: | + cd ./android + git clone --branch=fastlane-android --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane + cd fastlane + + rm -rf metadata/android/en-US/images/phoneScreenshots/* + cp -r ../../screenshots/. metadata/android/en-US/images/phoneScreenshots/ + + # Force push to fastlane branch + git checkout --orphan temporary + git add --all . + git commit -am "[Auto] Update screenshots for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))" + git branch -D fastlane-android + git branch -m fastlane-android + git push --force origin fastlane-android + - name: Upload Screenshots uses: actions/upload-artifact@v4 with: diff --git a/.github/actions/screenshot-ios/action.yml b/.github/actions/screenshot-ios/action.yml index e54bd94eb..7f7f31920 100644 --- a/.github/actions/screenshot-ios/action.yml +++ b/.github/actions/screenshot-ios/action.yml @@ -41,11 +41,38 @@ runs: shell: bash run: | flutter drive --driver=test_integration/test_driver.dart --target=test_integration/screenshots.dart -d "${{ inputs.IPHONE_DEVICE_MODEL }}" + cd ./screenshots + for file in 0{1..6}.png; do + mv "$file" "iPhone 16 Pro Max-${file}" + done - name: Capture iPad Screenshots shell: bash run: | flutter drive --driver=test_integration/test_driver.dart --target=test_integration/screenshots.dart -d "${{ inputs.IPAD_DEVICE_MODEL }}" + cd ./screenshots + for file in 0{1..6}.png; do + mv "$file" "iPad Pro 13-inch (M4)-${file}" + done + + - name: Update Fastlane Metadata + if: ${{ github.event_name != 'pull_request' }} + shell: bash + run: | + cd ./iOS + git clone --branch=fastlane-ios --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane + cd fastlane + + rm -rf screenshots/* + cp -r ../../screenshots/. screenshots/ + + # Force push to fastlane branch + git checkout --orphan temporary + git add --all . + git commit -am "[Auto] Update screenshots for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))" + git branch -D fastlane-ios + git branch -m fastlane-ios + git push --force origin fastlane-ios - name: Upload Screenshots uses: actions/upload-artifact@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 87ae29d3f..3ae2f7215 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,13 +28,7 @@ jobs: git config --global user.name "github-actions[bot]" git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - - name: Android Screenshot Workflow - uses: ./.github/actions/screenshot-android - with: - ANDROID_EMULATOR_API: ${{ env.ANDROID_EMULATOR_API }} - ANDROID_EMULATOR_ARCH: ${{ env.ANDROID_EMULATOR_ARCH }} - - - name: Update Fastlane Metadata + - name: Update Fastlane Metadata (Android) run: | cd ./android git clone --branch=fastlane-android --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane @@ -42,20 +36,42 @@ jobs: echo "${{ github.event.release.body }}" > metadata/android/en-US/changelogs/${{ steps.download-assets.outputs.VERSION_CODE }}.txt - rm -rf metadata/android/en-US/images/phoneScreenshots/* - cp -r ../../screenshots/. metadata/android/en-US/images/phoneScreenshots/ - # Force push to fastlane branch git checkout --orphan temporary git add --all . - git commit -am "[Auto] Update metadata for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))" + git commit -am "[Auto] Update changelogs for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))" git branch -D fastlane-android git branch -m fastlane-android git push --force origin fastlane-android - - name: Push version to production + - name: Push version to production (Android) run: | + cd ./android fastlane promoteToProduction version_code:${{ steps.download-assets.outputs.VERSION_CODE }} if [[ $? -ne 0 ]]; then exit 1 - fi \ No newline at end of file + fi + + - name: Update Fastlane Metadata (iOS) + run: | + cd ./iOS + git clone --branch=fastlane-ios --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane + cd fastlane + + echo "${{ github.event.release.body }}" > metadata/en-US/release_notes.txt + + # Force push to fastlane branch + git checkout --orphan temporary + git add --all . + git commit -am "[Auto] Update changelogs for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))" + git branch -D fastlane-ios + git branch -m fastlane-ios + git push --force origin fastlane-ios + + - name: Push version to production (iOS) + run: | + cd ./iOS + fastlane promoteToProduction build_number:${{ steps.download-assets.outputs.VERSION_CODE }} + if [[ $? -ne 0 ]]; then + exit 1 + fi diff --git a/README.md b/README.md index 81810e164..b8934805a 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,20 @@ There are a number of devices with Bluetooth on the market. As far as we can tel ## Screenshots -| | | | -|-------------|-------------|-------------| -| | | | -| | | | -| | | | + + + + + + + + + + + +
+ +
## Reverse-Engineering Bluetooth LE Devices diff --git a/test_integration/test_driver.dart b/test_integration/test_driver.dart index 49ce58f56..a46844ed9 100644 --- a/test_integration/test_driver.dart +++ b/test_integration/test_driver.dart @@ -7,8 +7,7 @@ Future main() async { await integrationDriver( onScreenshot: (String screenshotName, List screenshotBytes, [Map? args]) async { - final timeStamp = DateTime.now().millisecondsSinceEpoch.toString(); - final filePath = 'screenshots/$screenshotName-$timeStamp.png'; + final filePath = 'screenshots/$screenshotName.png'; print('Writing screenshot to $filePath'); final File image = await File(filePath).create(recursive: true);