Skip to content

Commit

Permalink
Set up release workflow (#38)
Browse files Browse the repository at this point in the history
* Set up release workflow

* Add ios deploy workflow

* Implement IOS Deploy Workflow

* Test release

* Fix pipeline

* Added push notification element

* Add Export Options

* Fix version

* format

* format

* Update Read me

* Removed cradentials files

* Reset secrets

* Pub get

* Removed jks file

* Set ios deploy on marge main

* Set up fastlane and android deploy workflow

* Changed package name

* Add proguard rules

* Add proguard rules

* Fix ios permission content

* Update deploy workflow

* Update IOS permission message

* Change android deploy workflow

* Fix pipeline

* Implement build deploy workflow
  • Loading branch information
cp-pratik-k authored Apr 29, 2024
1 parent 9400bab commit d11018e
Show file tree
Hide file tree
Showing 24 changed files with 571 additions and 197 deletions.
Binary file modified .DS_Store
Binary file not shown.
24 changes: 19 additions & 5 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,29 @@ jobs:
runs-on: ubuntu-latest

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

- uses: subosito/[email protected]
name: Set up Flutter SDK
- name: Set up Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: 'stable'
channel: stable
cache: true

- name: Retrieve the secret and decode it to a file
env:
FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }}
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
GOOGLE_SERVICE_INFO_PLIST_BASE64: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_BASE64 }}
FIREBASE_APP_ID_FILE_JSON_BASE64: ${{ secrets.FIREBASE_APP_ID_FILE_JSON_BASE64 }}

run: |
cd app
echo $FIREBASE_OPTIONS_BASE64 | base64 -di > lib/firebase_options.dart
echo $GOOGLE_SERVICES_JSON_BASE64 | base64 -di > android/app/google-services.json
echo $GOOGLE_SERVICE_INFO_PLIST_BASE64 | base64 --decode > ios/Runner/GoogleService-Info.plist
echo $FIREBASE_APP_ID_FILE_JSON_BASE64 | base64 --decode > ios/firebase_app_id_file.json
- name: Install dependencies
run: |
cd app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,37 @@ jobs:
runs-on: ubuntu-latest

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


- uses: actions/setup-java@v4
name: Set up JDK
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: 17.0.6
cache: 'gradle'

- uses: subosito/[email protected]
name: Set up Flutter SDK
- name: Set up Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: 'stable'
channel: stable
cache: true

- name: Set up ruby env
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.0
bundle-cache: true

- name: Retrieve the secret and decode it to a file
env:
FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }}
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
run: |
cd app
echo $FIREBASE_OPTIONS_BASE64 | base64 -di > lib/firebase_options.dart
echo $GOOGLE_SERVICES_JSON_BASE64 | base64 -di > android/app/google-services.json
- name: Install dependencies
run: |
cd app
Expand All @@ -41,7 +55,14 @@ jobs:
cd ..
- name: Build android APK
env:
APKSIGN_KEYSTORE_BASE64: ${{ secrets.APKSIGN_KEYSTORE_BASE64 }}
APKSIGN_KEYSTORE_PASS: ${{ secrets.APKSIGN_KEYSTORE_PASS }}
APKSIGN_KEY_ALIAS: ${{ secrets.APKSIGN_KEY_ALIAS }}
APKSIGN_KEY_PASS: ${{ secrets.APKSIGN_KEY_PASS }}
run: |
echo $APKSIGN_KEYSTORE_BASE64 | base64 -di > release.keystore
export APKSIGN_KEYSTORE=`pwd`/release.keystore
cd app
file='VERSION'
fileData=$(cat $file)
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/android_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Publish to Google Play Store

on:
push:
branches:
- main
workflow_dispatch:

jobs:
android_deploy:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: oracle
java-version: 17.0.6
cache: gradle

- name: Set up Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true

- name: Set up ruby env
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.0
bundle-cache: true

- name: Retrieve the secret and decode it to a file
env:
FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }}
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
run: |
cd app
echo $FIREBASE_OPTIONS_BASE64 | base64 -di > lib/firebase_options.dart
echo $GOOGLE_SERVICES_JSON_BASE64 | base64 -di > android/app/google-services.json
- name: Install dependencies
run: |
cd app
flutter clean
flutter pub get
cd ../data
flutter clean
flutter pub get
cd ../style
flutter clean
flutter pub get
cd ..
- name: Deploy Android Build Internally
env:
APP_PLAY_SERVICE_JSON: ${{ secrets.APP_PLAY_SERVICE_JSON_BASE64 }}
APKSIGN_KEYSTORE_BASE64: ${{ secrets.APKSIGN_KEYSTORE_BASE64 }}
APKSIGN_KEYSTORE_PASS: ${{ secrets.APKSIGN_KEYSTORE_PASS }}
APKSIGN_KEY_ALIAS: ${{ secrets.APKSIGN_KEY_ALIAS }}
APKSIGN_KEY_PASS: ${{ secrets.APKSIGN_KEY_PASS }}

run: |
echo $APKSIGN_KEYSTORE_BASE64 | base64 -di > release.keystore
export APKSIGN_KEYSTORE=`pwd`/release.keystore
cd app
file='VERSION'
fileData=`cat $file`
IFS='.'
read -a versionValue <<< "$fileData"
buildNumber=$(( ${versionValue[0]} * 1000000 + ${versionValue[1]} * 10000 + ${{ github.run_number }} ))
IFS=''
buildName="${versionValue[0]}.${versionValue[1]}.${{ github.run_number }}"
echo "Generating android build $buildName $buildNumber"
cd android
gem install bundler -v 2.4.22
bundle install
echo $APP_PLAY_SERVICE_JSON | base64 -di > google_play_api_key.json
bundle exec fastlane upload_internal versionName:$buildName versionCode:$buildNumber
101 changes: 101 additions & 0 deletions .github/workflows/ios_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Publish to App Store Connect

on:
push:
branches:
- main
workflow_dispatch:

jobs:
ios_deploy:
runs-on: macos-13

env:
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY_IDENTIFIER: ${{ secrets.APP_STORE_CONNECT_KEY_IDENTIFIER }}
APP_STORE_CONNECT_PRIVATE_KEY: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }}
APP_STORE_APP_ID: ${{ secrets.APP_STORE_APP_ID }}
DIST_CERTIFICATE: ${{ secrets.DIST_CERTIFICATE_BASE64 }}
DIST_CERTIFICATE_PASSWORD: ${{ secrets.DIST_CERTIFICATE_PASSWORD }}
DIST_PROFILE: ${{ secrets.DIST_PROFILE_BASE64 }}

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

- name: Set up Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true

- name: Retrieve the secret and decode it to a file
env:
FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }}
GOOGLE_SERVICE_INFO_PLIST_BASE64: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST_BASE64 }}
FIREBASE_APP_ID_FILE_JSON_BASE64: ${{ secrets.FIREBASE_APP_ID_FILE_JSON_BASE64 }}
run: |
cd app
echo $FIREBASE_OPTIONS_BASE64 | base64 --decode > lib/firebase_options.dart
echo $GOOGLE_SERVICE_INFO_PLIST_BASE64 | base64 --decode > ios/Runner/GoogleService-Info.plist
echo $FIREBASE_APP_ID_FILE_JSON_BASE64 | base64 --decode > ios/firebase_app_id_file.json
- name: Install dependencies
run: |
cd app
flutter clean
flutter pub get
cd ../data
flutter clean
flutter pub get
cd ../style
flutter clean
flutter pub get
cd ..
- name: Install Codemagic CLI tools
run: pip install codemagic-cli-tools

- name: Set up keychain
run: keychain initialize

- name: Set up Provisioning Profiles
run: |
PROFILES_HOME="$HOME/Library/MobileDevice/Provisioning Profiles"
mkdir -p "$PROFILES_HOME"
PROFILE_PATH="$(mktemp "$PROFILES_HOME"/$(uuidgen).mobileprovision)"
echo ${DIST_PROFILE} | base64 --decode > "$PROFILE_PATH"
echo "Saved Provisioning profile $PROFILE_PATH"
- name: Set up Signing certificate
run: |
echo $DIST_CERTIFICATE | base64 --decode > /tmp/certificate.p12
keychain add-certificates --certificate /tmp/certificate.p12 --certificate-password $DIST_CERTIFICATE_PASSWORD
- name: Set up code signing settings on Xcode project
run: xcode-project use-profiles

- name: Build ipa for distribution
run: |
cd app
file='VERSION'
fileData=`cat $file`
IFS='.'
read -a versionValue <<< "$fileData"
buildNumber=$(( ${versionValue[0]} * 1000000 + ${versionValue[1]} * 10000 + ${{ github.run_number }} ))
IFS=''
buildName="${versionValue[0]}.${versionValue[1]}.${{ github.run_number }}"
echo "Generating ios build $buildName $buildNumber"
flutter build ipa --release --build-number=$buildNumber --build-name=$buildName --export-options-plist=$HOME/export_options.plist
- name: Publish the app to App Store Connect
run: |
APP_FILE=$(find $(pwd) -name "*.ipa")
app-store-connect publish \
--path "$APP_FILE"


3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.swp
.idea/
.DS_Store
7 changes: 7 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release


# Credentials
lib/firebase_options.dart
ios/Runner/GoogleService-Info.plist
android/app/google-services.json
ios/firebase_app_id_file.json
3 changes: 2 additions & 1 deletion app/android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties

**/*.keystore
**/*.jks
3 changes: 3 additions & 0 deletions app/android/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "fastlane"
Loading

0 comments on commit d11018e

Please sign in to comment.