Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Codemagic advanced script doesn't work with patches #107

Open
mtwichel opened this issue Aug 4, 2023 · 2 comments
Open

docs: Codemagic advanced script doesn't work with patches #107

mtwichel opened this issue Aug 4, 2023 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@mtwichel
Copy link

mtwichel commented Aug 4, 2023

Description

The current codemagic "advanced example" is this:

workflows:
  advanced-example:
    name: Advanced Example
    environment:
      vars:
        TYPE: 'patch' # Can be 'patch' or 'release'
      groups:
        # Exports the SHOREBIRD_TOKEN environment variable
        - shorebird
      flutter: stable
    scripts:
      - name: 🐦 Setup Shorebird
        script: |
          # Install Shorebird
          curl --proto '=https' --tlsv1.2 https://raw.githubusercontent.com/shorebirdtech/install/main/install.sh -sSf | bash

          # Add Shorebird to PATH
          echo PATH="$HOME/.shorebird/bin:$PATH" >> $CM_ENV
      - name: 🙌 Shorebird Build
        script: |
          echo "➡️ Using type: $TYPE"

          # If type is neither "patch" nor "release", exit with error
          if [ "$TYPE" != "patch" ] && [ "$TYPE" != "release" ]; then
            echo "TYPE must be either 'patch' or 'release'"
            exit 1
          fi

          # Check type and run corresponding command
          if [ "$TYPE" == "patch" ]; then
            echo "🩹 Running patch command"
            shorebird patch android --force
          elif [ "$TYPE" == "release" ]; then
            echo "🚀 Running release command"
            shorebird release android --force
          fi

However, you will probably add a publishing section to your file so that you can get your apps on the stores. The problem is that when you do this, it will try to submit to the App Store you configured, even if you run a patch. Since no file is produced from the patch command, this makes the workflow fail.

I would suggest changing this example to have two workflows, one with the patch command and the other with the release command.

We've actually implemented this in our codemagic.yaml, as well as including a separate iOS and Android workflows, but it keeps it clean by reusing steps where possible. If you'd like, I'd be happy to clean off our domain-specific stuff and put up a PR on this page.

Thanks!

@mtwichel mtwichel added the documentation Improvements or additions to documentation label Aug 4, 2023
@mtwichel mtwichel changed the title docs: docs: Codemagic advanced script doesn't work with patches Aug 4, 2023
@eseidel
Copy link
Contributor

eseidel commented Aug 4, 2023

Thanks! FYI @nilsreichardt

@nilsreichardt
Copy link
Contributor

Yes, that makes sense, @mtwichel 👍 Thanks for filling this ticket ❤️ You can either just send me the codemagic.yaml and I update the docs, or you fill a PR - just as you like ✌️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants