Skip to content

Commit

Permalink
Release App (PATCH) (#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
marfavi authored Apr 23, 2023
2 parents 22a33fd + fa44816 commit 9977294
Show file tree
Hide file tree
Showing 263 changed files with 6,525 additions and 2,369 deletions.
1 change: 1 addition & 0 deletions .env.develop
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coffeeCardUrl="https://beta.analogio.dk/api/clippy"
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coffeeCardUrl="https://analogio.dk/clippy"
25 changes: 25 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Pipelines

## Actions secrets

| Secret name | Description |
|------------------------------------------------------ |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ANDROID_KEYSTORE` | Android Keystore used to sign Android release in base64 encoded format |
| `ANDROID_KEYSTORE_PASSWORD` | Keystore password |
| `ANDROID_KEY_ALIAS` | Alias for signing key in keystore |
| `ANDROID_KEY_PASSWORD` | Key password |
| `APPLE_IOS_PROVISIONING_PROFILE_DEVELOPMENT` | iOS Provisioning profile for development releases in base64 encoded format. The provisioning profile must be updated each time a new device is added to the profile in App Store Connect. |
| `APPLE_IOS_PROVISIONING_PROFILE_PROD` | iOS Provisioning profile for production releases in base64 encoded format |
| `APPLE_IOS_SIGNING_CERTIFICATE_DEVELOPMENT` | iOS certificate in base64 encoded format used to sign iOS app for development releases |
| `APPLE_IOS_SIGNING_CERTIFICATE_DEVELOPMENT_PASSWORD` | Certificate password |
| `APPLE_IOS_SIGNING_CERT_PROD` | iOS certificate in base64 encoded format used to sign iOS app for production releases |
| `APPLE_IOS_SIGNING_CERT_PW` | Certificate password |
| `APPLE_KEYCHAIN_PW` | Apple Keychain password |
| `APP_STORE_CONNECT_PASSWORD` | Apple App Store connect password |
| `APP_STORE_CONNECT_USERNAME` | Apple App Store connect username for GitHub Actions service user |
| `FIREBASE_ANDROID_APP_ID` | Firebase Android App identifier |
| `FIREBASE_ANDROID_SERVICES_JSON` | Google Services file for Android in JSON format |
| `FIREBASE_IOS_APP_ID` | Firebase iOS App identifier |
| `FIREBASE_IOS_SERVICES_JSON` | Google Services file for iOS in JSON format |
| `FIREBASE_TOKEN` | Firebase authentication token |
| `PLAYSTORE_SERVICE_ACCOUNT_JSON` | Google Play store service account used to authenticate to Play store in JSON format |
84 changes: 56 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ on:
inputs:
storeArtifacts:
type: boolean
required: true
required: false
outputs:
version_tag:
description: "Version used for Git tag"
value: ${{ jobs.version.outputs.version_tag }}

env:
FLUTTER_VERSION: 3.3.7
FLUTTER_VERSION: 3.7.8
JAVA_VERSION: 11.x

jobs:
Expand All @@ -30,6 +30,7 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Determine versioning
uses: paulhatch/[email protected]
id: versioning
Expand All @@ -39,11 +40,13 @@ jobs:
minor_pattern: "(MINOR)"
format: "${major}.${minor}.${patch}"
bump_each_commit: false

- name: Determine build version
id: build_version
run: |
BUILD_NO=$((${{ github.run_number }} + 100))
echo "::set-output name=build_no::$BUILD_NO"
- name: Print versioning
run: |
echo "Version: $VERSION"
Expand All @@ -53,6 +56,7 @@ jobs:
VERSION: ${{ steps.versioning.outputs.version }}
VERSION_TAG: ${{ steps.versioning.outputs.version_tag }}
BUILD_NO: ${{ steps.build_version.outputs.build_no }}

outputs:
version: ${{ steps.versioning.outputs.version }}
version_tag: ${{ steps.versioning.outputs.version_tag }}
Expand All @@ -66,62 +70,75 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Apple certificate and provisioning profile (dev)
run: .github/scripts/setup-certs.command
if: github.ref_name != 'production'
run: .github/scripts/setup-certs.command
env:
APPLE_IOS_SIGNING_CERT: ${{ secrets.APPLE_IOS_SIGNING_CERT }}
APPLE_IOS_SIGNING_CERT_PW: ${{ secrets.APPLE_IOS_SIGNING_CERT_PW }}
APPLE_IOS_PROVISIONING_PROFILE: ${{ secrets.APPLE_IOS_PROVISIONING_PROFILE }}
APPLE_IOS_SIGNING_CERT: ${{ secrets.APPLE_IOS_SIGNING_CERTIFICATE_DEVELOPMENT }}
APPLE_IOS_SIGNING_CERT_PW: ${{ secrets.APPLE_IOS_SIGNING_CERTIFICATE_DEVELOPMENT_PASSWORD }}
APPLE_IOS_PROVISIONING_PROFILE: ${{ secrets.APPLE_IOS_PROVISIONING_PROFILE_DEVELOPMENT }}
APPLE_KEYCHAIN_PW: ${{ secrets.APPLE_KEYCHAIN_PW }}

- name: Install Apple certificate and provisioning profile (prod)
run: .github/scripts/setup-certs.command
if: github.ref_name == 'production'
run: .github/scripts/setup-certs.command
env:
APPLE_IOS_SIGNING_CERT: ${{ secrets.APPLE_IOS_SIGNING_CERT_PROD }}
APPLE_IOS_SIGNING_CERT_PW: ${{ secrets.APPLE_IOS_SIGNING_CERT_PW }}
APPLE_IOS_PROVISIONING_PROFILE: ${{ secrets.APPLE_IOS_PROVISIONING_PROFILE_PROD }}
APPLE_KEYCHAIN_PW: ${{ secrets.APPLE_KEYCHAIN_PW }}

- name: Setup Java
uses: actions/[email protected]
with:
distribution: "adopt"
java-version: ${{ env.JAVA_VERSION }}

- name: Setup Flutter environment
uses: subosito/[email protected]
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"

- name: Download dependencies
run: flutter pub get
- name: Decode GoogleService-Info.plist
env:
SERVICES_JSON: ${{ secrets.FIREBASE_IOS_SERVICES_JSON }}
run: echo $SERVICES_JSON > ios/Runner/GoogleService-Info.plist

- name: Set URI (prod)
if: github.ref_name == 'production'
run: sed -i 's/.env.develop/.env.production/' lib/env/env.dart

- name: Generate code
run: scripts/.generate-code.sh code
run: flutter pub run build_runner build

- name: Build iOS (dev)
if: github.ref_name != 'production'
run: flutter build ios --release --no-codesign --build-name ${{ needs.version.outputs.version }} --build-number ${{ needs.version.outputs.build_version }}
run: flutter build ios --flavor development --release --no-codesign --build-name ${{ needs.version.outputs.version }} --build-number ${{ needs.version.outputs.build_version }} --target lib/main_development.dart
- name: Build iOS (prod)
if: github.ref_name == 'production'
run: flutter build ios --release --no-codesign --dart-define=IS_PROD=true --build-name ${{ needs.version.outputs.version }} --build-number ${{ needs.version.outputs.build_version }}
- name: Build resolve Swift dependencies
run: xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme Runner -configuration Release
run: flutter build ios --flavor production --release --no-codesign --build-name ${{ needs.version.outputs.version }} --build-number ${{ needs.version.outputs.build_version }} --target lib/main_production.dart
- name: Build resolve Swift dependencies (dev)
if: github.ref_name != 'production'
run: xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme production -configuration Release-production
- name: Build resolve Swift dependencies (prod)
if: github.ref_name == 'production'
run: xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme development -configuration Release-development
- name: Build xArchive (dev)
if: github.ref_name != 'production'
run: |
xcodebuild -workspace ios/Runner.xcworkspace -scheme Runner -configuration Release DEVELOPMENT_TEAM=Y5U9T77F2K -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath build-output/app.xcarchive PROVISIONING_PROFILE_SPECIFIER="githubactions-dev" clean archive CODE_SIGN_IDENTITY="Apple Development: Jonas Anker Rasmussen"
xcodebuild -workspace ios/Runner.xcworkspace -scheme development -configuration Release-development DEVELOPMENT_TEAM=Y5U9T77F2K -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath build-output/app.xcarchive PROVISIONING_PROFILE_SPECIFIER="development" clean archive CODE_SIGN_IDENTITY="iPhone Developer"
- name: Build xArchive (prod)
if: github.ref_name == 'production'
run: |
xcodebuild -workspace ios/Runner.xcworkspace -scheme Runner -configuration Release DEVELOPMENT_TEAM=Y5U9T77F2K -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath build-output/app.xcarchive PROVISIONING_PROFILE_SPECIFIER="githubactions-prod" clean archive CODE_SIGN_IDENTITY="Apple Distribution"
xcodebuild -workspace ios/Runner.xcworkspace -scheme production -configuration Release-production DEVELOPMENT_TEAM=Y5U9T77F2K -sdk 'iphoneos' -destination 'generic/platform=iOS' -archivePath build-output/app.xcarchive PROVISIONING_PROFILE_SPECIFIER="githubactions-prod" clean archive CODE_SIGN_IDENTITY="Apple Distribution"
- name: Export ipa (dev)
if: github.ref_name != 'production'
run: xcodebuild -exportArchive -archivePath build-output/app.xcarchive -exportPath build-output/ios -exportOptionsPlist ios/exportOptions.dev.plist

- name: Export ipa (prod)
if: github.ref_name == 'production'
run: xcodebuild -exportArchive -archivePath build-output/app.xcarchive -exportPath build-output/ios -exportOptionsPlist ios/exportOptions.prod.plist

- name: Upload iOS build
if: ${{ inputs.storeArtifacts }}
uses: actions/[email protected]
Expand All @@ -135,40 +152,44 @@ jobs:
name: Build Android App
runs-on: ubuntu-latest
needs: [version]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Java
uses: actions/[email protected]
with:
distribution: "adopt"
java-version: ${{ env.JAVA_VERSION }}

- name: Setup Flutter environment
uses: subosito/[email protected]
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"

- name: Download dependencies
run: flutter pub get
- name: Decode google-services.json
env:
SERVICES_JSON: ${{ secrets.FIREBASE_ANDROID_SERVICES_JSON }}
run: echo $SERVICES_JSON > android/app/google-services.json

- name: Set URI (prod)
if: github.ref_name == 'production'
run: sed -i 's/.env.develop/.env.production/' lib/env/env.dart

- name: Generate code
run: scripts/.generate-code.sh code
run: flutter pub run build_runner build

- name: Build appbundle (dev)
if: github.ref_name != 'production'
run: flutter build apk --release --build-name ${{ needs.version.outputs.version }} --build-number ${{ needs.version.outputs.build_version }}
run: flutter build apk --flavor development --release --build-name ${{ needs.version.outputs.version }} --build-number ${{ needs.version.outputs.build_version }} --target lib/main_development.dart
- name: Build appbundle (prod)
if: github.ref_name == 'production'
run: flutter build apk --release --dart-define=IS_PROD=true --build-name ${{ needs.version.outputs.version }} --build-number ${{ needs.version.outputs.build_version }}
run: flutter build apk --flavor production --release --dart-define=IS_PROD=true --build-name ${{ needs.version.outputs.version }} --build-number ${{ needs.version.outputs.build_version }} --target lib/main_production.dart
- name: Upload Android build
if: ${{ inputs.storeArtifacts }}
uses: actions/[email protected]
with:
name: android
path: build/app/outputs/apk/release
path: build/app/outputs/flutter-apk
retention-days: 1
if-no-files-found: error

Expand All @@ -179,21 +200,28 @@ jobs:
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Setup Flutter environment
uses: subosito/[email protected]
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: "stable"

- name: Download dependencies
run: flutter pub get

- name: Generate code
run: scripts/.generate-code.sh code
run: flutter pub run build_runner build

- name: Check formatting
run: flutter format --set-exit-if-changed .

- name: Static Analysis
run: flutter analyze

- name: Run tests
run: flutter test --coverage

- name: Upload test report to Codecov
uses: codecov/[email protected]
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
appId: ${{ secrets.FIREBASE_ANDROID_APP_ID }}
token: ${{ secrets.FIREBASE_TOKEN }}
groups: analogio-devs
file: app-release.apk
file: app-development-release.apk

prod_release_ios:
name: Upload iOS build to App Store connect
runs-on: macos-latest
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
releaseFiles: ${{ steps.sign_app.outputs.signedReleaseFile }}
track: internal
status: draft

tag:
name: Git Tag version
runs-on: ubuntu-latest
Expand Down
Loading

0 comments on commit 9977294

Please sign in to comment.