Skip to content

CI Integration

Building with Patchwing in CI should be a very small change from your existing Flutter CI builds. Changes required:

  1. Installing Patchwing on the builder.
  2. Getting Patchwing credentials onto the builder.
  3. Replacing flutter build --release with patchwing release or patchwing patch.

We have detailed instructions for integrating into these providers:

GitHub Integrate Patchwing into your GitHub Actions workflows.
Codemagic Integrate Patchwing into your Codemagic CI/CD pipelines.

If you do not use these providers, we’ve also provided generic instructions below:

Installing Patchwing is identical to how you install it locally. Most builders use Linux or Mac, which means running:

curl --proto '=https' --tlsv1.2 https://raw.githubusercontent.com/AstralWing/patchwing/main/install.sh -sSf | bash

for more details, see Getting Started.

Getting Patchwing credentials onto the builder

Section titled “Getting Patchwing credentials onto the builder”

Most Patchwing functionality, like creating releases and patches, requires authentication. To authenticate in your CI, create an API key from the Patchwing Console:

  1. Go to Account → API Keys.
  2. Click Create API Key.
  3. Give the key a name (e.g., “GitHub Actions — my-app”), choose an expiration, and select a permission level.
  4. Copy the key value — it is only shown once.

Use this key as your PATCHWING_TOKEN in CI. The environment variable name is unchanged from previous versions.

See API Keys for details on permission levels and other key management options.

Now that you have a token, it is important to keep that token secure. We recommend using a secrets manager for the token, or secure environment variables, depending on your CI setup. patchwing commands will look for the token to be in a PATCHWING_TOKEN environment variable.

Replacing flutter build --release with patchwing.

Section titled “Replacing flutter build --release with patchwing.”

If you’re already building with Flutter in CI, you should see a line similar to flutter build aab or flutter build ipa in your CI config.

To move to Patchwing, you need only replace the flutter build line with patchwing release. For example:

flutter build ipa --dart-define=HERO=Mario

Would become:

patchwing release ios --dart-define=HERO=Mario

patchwing release supports almost all of the same arguments that flutter build does. If you ever see an error with patchwing release not supporting an argument that flutter build does, you can use -- to tell patchwing to pass any argument after -- down to flutter build separately, e.g.

flutter build ipa --dart-define=HERO=Mario --enable-impeller

Would become:

patchwing release ios --dart-define=HERO=Mario -- --enable-impeller

patchwing can support building with different versions of Flutter. By default patchwing will use whatever the most recent Flutter stable is, which can change. If you’d like to pin your CI to a specific Flutter version you can do this by adding --flutter-version to your command, e.g.

patchwing release ios --flutter-version=3.44.0 --dart-define=HERO=Mario -- --enable-impeller

Patching is identical to releasing, just use patchwing patch instead of patchwing release.

Patches with Patchwing can only ever apply to an existing Release. By definition a patch is a set of changes to apply to a Release.

patchwing patch does not take a --flutter-version argument, instead takes a --release-version argument, to specify which release version of your app you’re trying to patch. patchwing will look up the exact version of Flutter used to build the release and use that exact version to build the patch.

Thank you for reading this guide! If you have any questions or suggestions, feel free to reach out to us via email.