Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
fremartini committed Oct 15, 2023
2 parents 005dcd2 + 041b53d commit 5f327ac
Showing 12 changed files with 194 additions and 180 deletions.
17 changes: 10 additions & 7 deletions .github/actions/build_android/action.yml
Original file line number Diff line number Diff line change
@@ -10,6 +10,9 @@ inputs:
store_artifacts:
required: false
description: "Store artifact"
prod_release:
required: true
description: "Is prod release"

runs:
using: "composite"
@@ -18,7 +21,7 @@ runs:
uses: ./.github/actions/setup_flutter_environment

- name: Replace target URI in Production
if: github.ref_name == 'production'
if: ${{ inputs.prod_release }} == 'true'
run: sed -i 's/.env.develop/.env.production/' lib/env/env.dart
shell: bash

@@ -27,17 +30,17 @@ runs:
shell: bash

- name: Build apk (dev)
if: github.ref_name != 'production'
run: flutter build apk --flavor development --release --build-name ${{ inputs.version }} --build-number ${{ inputs.build_version }} --target lib/main_development.dart
if: ${{ inputs.prod_release }} != 'true'
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
shell: bash

- name: Build appbundle (prod)
if: ${{ github.ref_name == 'production'}}
run: flutter build appbundle --release --flavor production --build-name ${{ inputs.version }} --build-number ${{ inputs.build_version }} --target lib/main_production.dart
if: ${{ inputs.prod_release }} == 'true'
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
shell: bash

- name: Upload Android build (dev)
if: ${{ !!inputs.store_artifacts && github.ref_name != 'production'}}
if: ${{ !!inputs.store_artifacts && ${{ inputs.prod_release }} != 'true' }}
uses: actions/upload-artifact@v3.0.0
with:
name: android
@@ -46,7 +49,7 @@ runs:
if-no-files-found: error

- name: Upload Android build (prod)
if: ${{ !!inputs.store_artifacts && github.ref_name == 'production'}}
if: ${{ !!inputs.store_artifacts && ${{ inputs.prod_release }} == 'true' }}
uses: actions/upload-artifact@v3.0.0
with:
name: android
49 changes: 10 additions & 39 deletions .github/actions/build_ios/action.yml
Original file line number Diff line number Diff line change
@@ -29,14 +29,17 @@ inputs:
required: true
description: "Keychain password"
store_artifacts:
required: false
required: true
description: "Store artifact"
prod_release:
required: true
description: "Is prod release"

runs:
using: "composite"
steps:
- name: Install Apple certificate and provisioning profile (dev)
if: github.ref_name != 'production'
if: ${{ inputs.prod_release }} != 'true'
run: .github/scripts/setup-certs.command
env:
APPLE_IOS_SIGNING_CERT: ${{ inputs.apple_ios_signing_cert_dev }}
@@ -46,7 +49,7 @@ runs:
shell: bash

- name: Install Apple certificate and provisioning profile (prod)
if: github.ref_name == 'production'
if: ${{ inputs.prod_release }}== 'true'
run: .github/scripts/setup-certs.command
env:
APPLE_IOS_SIGNING_CERT: ${{ inputs.apple_ios_signing_cert_prod }}
@@ -68,45 +71,13 @@ runs:
shell: bash

- name: Build iOS (dev)
if: github.ref_name != 'production'
run: flutter build ios --flavor development --release --no-codesign --build-name ${{ inputs.version }} --build-number ${{ inputs.build_version }} --target lib/main_development.dart
if: ${{ inputs.prod_release }} != 'true'
run: .github/scripts/build-dev.sh ${{ needs.version.outputs.version }} ${{ needs.version.outputs.build_version }}
shell: bash

- name: Build iOS (prod)
if: github.ref_name == 'production'
run: flutter build ios --flavor production --release --no-codesign --build-name ${{ inputs.version }} --build-number ${{ inputs.build_version }} --target lib/main_production.dart
shell: bash

- name: Build resolve Swift dependencies (dev)
if: github.ref_name != 'production'
run: xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme development -configuration Release-development
shell: bash

- name: Build resolve Swift dependencies (prod)
run: xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme production -configuration Release-production
if: github.ref_name == 'production'
shell: bash

- name: Build xArchive (dev)
if: github.ref_name != 'production'
run: |
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"
shell: bash

- name: Build xArchive (prod)
if: github.ref_name == 'production'
run: |
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"
shell: bash

- 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
shell: bash

- 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
if: ${{ inputs.prod_release }} == 'true'
run: .github/scripts/build-prod.sh ${{ needs.version.outputs.version }} ${{ needs.version.outputs.build_version }}
shell: bash

- name: Upload iOS build
49 changes: 0 additions & 49 deletions .github/actions/versioning/action.yml

This file was deleted.

9 changes: 9 additions & 0 deletions .github/scripts/build-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/bash

BUILD_NAME=$1
BUILD_NUMBER=$2

flutter build ios --flavor development --release --no-codesign --build-name $BUILD_NAME --build-number $BUILD_NUMBER --target lib/main_development.dart
xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme development -configuration Release-development
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"
xcodebuild -exportArchive -archivePath build-output/app.xcarchive -exportPath build-output/ios -exportOptionsPlist ios/exportOptions.dev.plist
10 changes: 10 additions & 0 deletions .github/scripts/build-prod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /bin/bash

BUILD_NAME=$1
BUILD_NUMBER=$2

sed -i '' 's/.env.develop/.env.production/' lib/env/env.dart
flutter build ios --flavor production --release --no-codesign --build-name $BUILD_NAME --build-number $BUILD_NUMBER --target lib/main_production.dart
xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme production -configuration Release-production
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"
xcodebuild -exportArchive -archivePath build-output/app.xcarchive -exportPath build-output/ios -exportOptionsPlist ios/exportOptions.prod.plist
File renamed without changes.
47 changes: 31 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Build application

on:
push:
branches: [develop, production]
pull_request:
branches: [ main ]

workflow_dispatch:

@@ -11,28 +11,41 @@ on:
store_artifacts:
type: boolean
required: false
outputs:
version_tag:
description: "Version used for Git tag"
value: ${{ jobs.version.outputs.version_tag }}
default: false
prod_release:
type: boolean
required: false
tag_name:
type: string
required: false

env:
PROD_RELEASE: ${{ inputs.prod_release || 'false' }}
TAG_NAME: ${{ inputs.tag_name || 'dev' }}

jobs:
version:
name: Versioning
runs-on: ubuntu-latest

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

- name: Determine version
id: versioning
uses: ./.github/actions/versioning
- 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"
echo "Run No: $BUILD_NO"
env:
VERSION: ${{ env.TAG_NAME }}
BUILD_NO: ${{ steps.build_version.outputs.build_no }}

outputs:
version: ${{ steps.versioning.outputs.version }}
version_tag: ${{ steps.versioning.outputs.version_tag }}
build_version: ${{ steps.versioning.outputs.build_version }}
version: ${{ env.TAG_NAME }}
build_version: ${{ steps.build_version.outputs.build_no }}

build_ios:
name: Build iOS App
@@ -55,6 +68,7 @@ jobs:
apple_ios_provisioning_profile_prod: ${{ secrets.APPLE_IOS_PROVISIONING_PROFILE_PROD }}
apple_keychain_pw: ${{ secrets.APPLE_KEYCHAIN_PW }}
store_artifacts: ${{ inputs.store_artifacts }}
prod_release: ${{ env.PROD_RELEASE }}

build_android:
name: Build Android App
@@ -69,4 +83,5 @@ jobs:
with:
version: ${{ needs.version.outputs.version }}
build_version: ${{ needs.version.outputs.build_version }}
store_artifacts: ${{ inputs.store_artifacts }}
store_artifacts: ${{ inputs.store_artifacts }}
prod_release: ${{ env.PROD_RELEASE }}
2 changes: 1 addition & 1 deletion .github/workflows/codesee.yml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
on:
push:
branches:
- develop
- main
pull_request_target:
types: [opened, synchronize, reopened]

55 changes: 55 additions & 0 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Publish Development App

on:
push:
branches: [ main ]

jobs:
build_and_test:
uses: ./.github/workflows/build.yml
with:
store_artifacts: true
prod_release: false
secrets: inherit

dev_upload_ios:
name: Upload iOS build to Firebase App Distribution
runs-on: ubuntu-latest
needs: [build_and_test]

steps:
- name: Download Artifact
uses: actions/download-artifact@v3.0.0
with:
name: ios

- name: Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1.3.3
with:
appId: ${{ secrets.FIREBASE_IOS_APP_ID }}
token: ${{ secrets.FIREBASE_TOKEN }}
# FIXME: token is deprecated, use serviceCredentialsFileContent instead
# serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
groups: analogio-devs
file: Analog.ipa

dev_upload_android:
name: Upload Android build to Firebase App Distribution
runs-on: ubuntu-latest
needs: [build_and_test]

steps:
- name: Download artifact
uses: actions/download-artifact@v3.0.0
with:
name: android

- name: Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1.3.3
with:
appId: ${{ secrets.FIREBASE_ANDROID_APP_ID }}
token: ${{ secrets.FIREBASE_TOKEN }}
# FIXME: token is deprecated, use serviceCredentialsFileContent instead
# serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
groups: analogio-devs
file: app-development-release.apk
Loading

0 comments on commit 5f327ac

Please sign in to comment.