GithubHelp home page GithubHelp logo

altevedev / action-flutter-build-ios Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cedvdb/action-flutter-build-ios

0.0 0.0 0.0 298 KB

Github action that sets up a macos environment to build an ios app

License: MIT License

action-flutter-build-ios's Introduction

Setups the macos environment to be able to build a flutter app targetting ios.

This requires some steps in order for this action to be successful:

See also

1. Gather the certificate and provisioning profile

You'll need:

  • the p12 ditribution certificate
  • the password for the p12 certificate
  • the provisioning profile (most likely distribution or ad_hoc)

Here is how to get those

2. Add secrets values in your repository settings

Base64 encode the certificate and provisioning profiles

base64 -i BUILD_CERTIFICATE.p12 | pbcopy

and

base64 -i PROVISIONING_PROFILE.mobileprovision | pbcopy

and add those values to your github repository secrets. The keychain password can be any random string.

secrets

  • IOS_BUILD_CERTIFICATE_BASE64 : This is the base64 version of your certificate.p12
  • IOS_BUILD_CERTIFICATE_PASSWORD : This is the password for certificate.p12
  • IOS_GITHUB_KEYCHAIN_PASSWORD : A random string of your choosing
  • IOS_MOBILE_PROVISIONING_PROFILE_BASE64 : The base64 version of your.mobileprovision file

3. Build locally

Follow this step closely:

  1. In Xcode, automatic signing should be checked for a new flutter project. Build your project once with this enabled.
  2. Once your app has been built locally, you should have a ExportOptions.plist file created in the build directory build/ios/ipa/ExportOptions.plist.
  3. Copy the content of ExportOptions.plist and add it to a new GithubActionsExportOptions.plist file in the ios directory. This will be used by the action to sign the app.
  4. Change the signingStyle to manual and add your provisional profile into GithubActionsExportOptions.plist. You should have this:
<key>signingStyle</key>
<string>manual</string>
<key>provisioningProfiles</key>
<dict>
  <key>com.myapp.app.dev</key>
  <string>{{ YOUR PROFIL NAME }}</string>
</dict>

You can find the profile name in the developer account profile list

  1. In Xcode, untick the Automatic signing checkbox for the release build and choose your profile (the same as above). Keep the signing manual for release builds.

  2. You should now be able to build the project locally the same way it will be built in the action, verify that it is the case:

flutter build ipa --release --export-options-plist ios/GithubActionsExportOptions.plist

4. Usage

name: Build and distribute

on:
  push:
    branches:
      - main

jobs:
  build:
    name: build
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v2

      - uses: cedvdb/action-flutter-build-ios@v1
        with:
          # always use --export-options-plist=ios/GithubActionsExportOptions.plist
          build-cmd: flutter build ipa --release --flavor dev --export-options-plist=ios/GithubActionsExportOptions.plist
          certificate-base64: ${{ secrets.IOS_BUILD_CERTIFICATE_BASE64 }}
          certificate-password: ${{ secrets.IOS_BUILD_CERTIFICATE_PASSWORD }}
          provisioning-profile-base64: ${{ secrets.IOS_MOBILE_PROVISIONING_PROFILE_BASE64 }}
          keychain-password: ${{ secrets.IOS_GITHUB_KEYCHAIN_PASSWORD }}

      - name: Archive IPA
        uses: actions/upload-artifact@v2
        with:
          name: release-ipa
          # Try running the build locally with the build command to be sure of this path
          path: build/ios/ipa/App-dev.ipa

Note: when using the build-cmd, use the --export-options-plist=ios/GithubActionsExportOptions.plist argument, so it uses the export option created in step #3.

action-flutter-build-ios's People

Contributors

altevedev avatar cedvdb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.