Skip to content

Commit

Permalink
chore: setup release infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
AsCress committed Jan 30, 2025
1 parent 602d170 commit bae4dbd
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 23 deletions.
19 changes: 19 additions & 0 deletions .github/actions/screenshot-android/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
27 changes: 27 additions & 0 deletions .github/actions/screenshot-ios/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
62 changes: 46 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,36 @@ name: Release

on:
release:
types: [published]
types: [ published ]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ANDROID_EMULATOR_API: 34
ANDROID_EMULATOR_ARCH: x86_64

jobs:
release:
name: Release
if: ${{ github.repository == 'fossasia/badgemagic-app' }}
runs-on: ubuntu-latest

steps:
- name: Download repository
uses: actions/checkout@v4

- name: Prepare Secrets (Android)
env:
ENCRYPTED_F10B5E0E5262_IV: ${{ secrets.ENCRYPTED_F10B5E0E5262_IV }}
ENCRYPTED_F10B5E0E5262_KEY: ${{ secrets.ENCRYPTED_F10B5E0E5262_KEY }}
run: |
bash scripts/prep-android-key.sh
- name: Prepare Secrets (iOS)
if: ${{ github.repository == 'fossasia/badgemagic-app' }}
env:
ENCRYPTED_IOS_IV: ${{ secrets.ENCRYPTED_IOS_IV }}
ENCRYPTED_IOS_KEY: ${{ secrets.ENCRYPTED_IOS_KEY }}
run: |
bash scripts/prep-ios-key.sh
- name: Download Assets
id: download-assets
run: |
Expand All @@ -28,34 +42,50 @@ 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
cd fastlane
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
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
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,20 @@ There are a number of devices with Bluetooth on the market. As far as we can tel

## Screenshots

| <!-- --> | <!-- --> | <!-- --> |
|-------------|-------------|-------------|
| <img src="./docs/images/screen-1.jpg" width="288" /> <img src="./docs/images/screen-1-hard.png" width="288" /> | <img src="./docs/images/screen-2.jpg" width="288" /> <img src="./docs/images/screen-2-hard.png" width="288" /> | <img src="./docs/images/screen-3.jpg" width="288" /> <img src="./docs/images/screen-3-hard.png" width="288" /> |
| <!-- --> | <!-- --> | <!-- --> |
| <img src="./docs/images/screen-4.jpg" width="288" /> <img src="./docs/images/screen-4-hard.png" width="288" /> | <img src="./docs/images/screen-5.jpg" width="288" /> <img src="./docs/images/screen-5-hard.png" width="288" /> | <img src="./docs/images/screen-6.jpg" width="288" /> <img src="./docs/images/screen-6-hard.png" width="288" /> |
<table>
<tr>
<td><img src="https://github.com/fossasia/badgemagic-app/blob/fastlane-android/metadata/android/en-US/images/phoneScreenshots/01.png" width="1080"/></td>
<td><img src="https://github.com/fossasia/badgemagic-app/blob/fastlane-android/metadata/android/en-US/images/phoneScreenshots/02.png" width="1080"/></td>
<td><img src="https://github.com/fossasia/badgemagic-app/blob/fastlane-android/metadata/android/en-US/images/phoneScreenshots/03.png" width="1080"/></td>
<td><img src="https://github.com/fossasia/badgemagic-app/blob/fastlane-android/metadata/android/en-US/images/phoneScreenshots/04.png" width="1080"/></td>
</tr>
<tr>
<td><img src="https://github.com/fossasia/badgemagic-app/blob/fastlane-android/metadata/android/en-US/images/phoneScreenshots/05.png" width="1080"/></td>
<td colspan="3">
<img src="https://github.com/fossasia/badgemagic-app/blob/fastlane-android/metadata/android/en-US/images/phoneScreenshots/06.png" width="2146"/>
</td>
</tr>
</table>

## Reverse-Engineering Bluetooth LE Devices

Expand Down
3 changes: 1 addition & 2 deletions test_integration/test_driver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Future<void> main() async {
await integrationDriver(
onScreenshot: (String screenshotName, List<int> screenshotBytes,
[Map<String, Object?>? 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);
Expand Down

0 comments on commit bae4dbd

Please sign in to comment.