riverscuomo / public-bug-hunt

A place to file bug reports for all of my apps
GNU General Public License v3.0
7 stars 0 forks source link

automate deployment #92

Closed riverscuomo closed 5 months ago

riverscuomo commented 11 months ago

These are the steps in my flutter app deployment. does this seem like a good candidate for CodeMagic?

ANDROID Increment pubspec.yml & commit & push make sure you're in the dir for the specific app: weezify flutter build appbundle --obfuscate --split-debug-info=android/debug_info/ firebase crashlytics:symbols:upload --app=1:xxxxandroid/debug_info/ internal-testing page Create new release Upload add 'whatsnew.md' to Release Notes Next Save and Publish

iOS mac VS Code: Open weezify cd ios. OR pwd (to see which directory it's in) git checkout main git pull OR git reset --hard origin/main

Increment build (and version?) in your vscode pubspec.yml file. Check discord for last released version. rm Podfile.lock && pod repo update flutter clean && flutter pub get && pod install

MAKE SURE YOU'RE IN weezify!!! click on white icon. If not, go Open under File" wait for all indexing | processing to finish. Could take 15 mins Click on Runner and make sure the bundleId = com.rivertube "If you want to run and debug the app on iOS simulator

  1. At the top of the window, near the play and stop buttons, you'll see a dropdown menu. In this menu, you can select iPhone 14 Pro

  2. Click on the Play button. This will build and run your application.

  3. Upon successful build, Xcode will automatically launch your app in the iOS Simulator.

If you encounter any issues during the build, Xcode console will show build logs with details about the issue. You can get additional help by double-clicking on the issue in the log, which will take you to the source of the problem in your code.

Feel free to edit in vs code?" "General: Increment xcode version and build numbers (make sure you're in the right app). If both numbers are already released = fail. If Version is new and Build is old = works but doesn't autobump the version in the console " Signing & Capabilities: Automatically manage signing (RIVERS CUOMO) product (at the very top of screen) / archive (make sure you're building for any iOS device). 5 mins Distribute App (window will pop up) Click 'Next' for to accept all defaults, including Automatically manage signing Upload. 5 mins

riverscuomo commented 11 months ago

Could codemagic handle the actual uploading and deployment to the 2 stores? right now we still have to do it manually.

ASSISTANT Yes, Codemagic can handle the actual uploading and deployment to both the Google Play Store and the Apple App Store.

This automation can significantly streamline your workflows and save time in the app deployment process. You will need to provide Codemagic with necessary credentials and API access for both stores. The Codemagic documentation provides clear instructions to help you set this all up.

Please make sure to secure these sensitive pieces of information and store them securely, these credentials typically have extensive permissions and could be harmful if exposed. USER could gh actions do that as well? ASSISTANT Yes, GitHub Actions can also automate the process of deploying applications to both the Google Play Store and the Apple App Store.

Just like with Codemagic, you will need to provide GitHub Actions with the necessary credentials and access to the app stores.

Keep in mind that while GitHub Actions are powerful and flexible, they might require more setup and configuration compared to more specialized CI/CD tools like Codemagic. The choice between the two can often come down to the complexity of your project and your personal preference or familiarity with the tools.

riverscuomo commented 11 months ago

GitHub Actions CI/CD

Is it a good goal to want GitHub actions to automatically build and deploy my Android and iOS apps? There are two apps in a mono repo. Also I have an existing deploy.yaml file that automatically builds and deploys the web app version here's the file

name: Deploy to Firebase Hosting

Yes, it is a good goal to set up a Continuous Integration and Continuous Deployment (CI/CD) system for Android and iOS apps as well.

Automating your build and deployment process can:

  1. Increase your productivity by taking care of mundane tasks or tasks that you can forget (like updating version numbers).
  2. Ensure your tests are run regularly and consistently.
  3. Catch errors sooner rather than later by making sure your code builds and all tests pass before merging.
  4. Increase the reliability of your software releases by ensuring the same process is used to create each build.
  5. Increase confidence when deploying to production because you know that your deployment process has been thoroughly tested.

However, you might need to modify or add new steps to the existing deploy.yaml file. Building Android and iOS apps require different actions and tools compared to web apps.

For Android, you'd need to set up Gradle and Android SDK. Then, run suitable commands to build the APK or AAB (Android App Bundle). The final built app can then be uploaded to Firebase App Distribution or Google Play Store.

For iOS, you'd need a macOS environment so runs-on: macos-latest will be used rather than ubuntu-latest. You will also need to set up Flutter for iOS along with Cocoapods and Xcode. Then you might need to handle provisioning profiles, certificates, etc. before building the IPA file. The final built app can then be uploaded to Firebase App Distribution or Apple App Store.

Keep in mind that iOS build and deployment process is more complex due to its strong emphasis on security and privacy.

All in all, automating the build process for Android and iOS apps in a mono repo is absolutely feasible, and GitHub Actions is a solid choice for the task. However, it does require careful configuration and management due to the complexity of the mobile app development lifecycle.

riverscuomo commented 11 months ago

Migrating web app deploy.yml from GH to Codemagic

Codemagic actually supports building and deploying web applications as well. You can use Codemagic to deploy your Flutter web application to Firebase, much like in your existing GitHub Actions script.

This means you could potentially move all your CI/CD workflows (even for the web app) to Codemagic, making everything centralized and consistent in one place.

Migrating your existing GitHub Actions scripts to Codemagic should be straightforward. Codemagic provides a flexible configuration file (codemagic.yaml) that allows you to define workflows as you need. The steps in the codemagic.yaml file are similar to those you'd write in a GitHub workflow file.

But if for any reason you don't want to move your web app from GitHub Actions, you can certainly continue using both GitHub Actions for your web app and Codemagic for your mobile apps. Your development process would then involve two different CI/CD systems, but it's a totally viable option.

In a nutshell, both GitHub Actions and Codemagic have their strengths. Your decision depends on your team's specific needs and which trade-offs are most acceptable to you.

riverscuomo commented 11 months ago

Where do I put codemagic.yml?

A codemagic.yaml file is expected to be present at the root of your repository. Therefore, you should place it in the parentdir.

Your directory structure would look like this:

parentdir
  |-- codemagic.yaml
  |-- sharedresources
  |-- app1
  |-- app2

When Codemagic checks out your repository, it looks for codemagic.yaml at the root level. If it finds the configuration file there, it will use the instructions defined in that file to perform the build tasks.

In your codemagic.yaml file, you'd most likely have different workflows or adjust the scripts to build the correct app (app1 or app2) based on the files changed or some other condition.

Remember to specify the correct path in your scripts. For instance, if you're changing into the app1 directory to perform Flutter commands, you'd write cd app1 in your scripts. Always assume that the scripts are being run at the root level of your repository.