|
| 1 | +Trigger Codemagic workflow |
| 2 | +========================== |
| 3 | + |
| 4 | +GitHub Action to trigger a workflow on Codemagic. |
| 5 | + |
| 6 | +Quick start |
| 7 | +----------- |
| 8 | + |
| 9 | +Add the following configuration to `.github/workflows/main.yml` to trigger Codemagic build on any push event. |
| 10 | + |
| 11 | + on: push |
| 12 | + |
| 13 | + jobs: |
| 14 | + trigger-codemagic-build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Trigger Codemagic build |
| 18 | + uses: codemagic-ci-cd/trigger-codemagic-workflow-action@v1.0.0 |
| 19 | + with: |
| 20 | + app-id: <MY-APPLICATION-ID> |
| 21 | + workflow-id: <MY-WORKFLOW-ID> |
| 22 | + token: ${{ secrets.CODEMAGIC_API_TOKEN }} |
| 23 | + |
| 24 | +Arguments |
| 25 | +--------- |
| 26 | + |
| 27 | +| Argument | Description | |
| 28 | +| ------------- | ------------------------------------------------------------------------------------------------- | |
| 29 | +| `app-id` | [Application ID](https://docs.codemagic.io/rest-api/applications/) [**required**] | |
| 30 | +| `workflow-id` | [Workflow ID](https://docs.codemagic.io/rest-api/builds/) [**required**] | |
| 31 | +| `token` | [API token](https://docs.codemagic.io/rest-api/codemagic-rest-api/#authentication) [**required**] | |
| 32 | +| `branch` | GitHub event branch override | |
| 33 | +| `tag` | GitHub event tag override | |
| 34 | +| `labels` | Build labels, one label per line | |
| 35 | +| `xcode` | Xcode version e.g. 14.1 | |
| 36 | +| `flutter` | Flutter version e.g. 3.3.3 | |
| 37 | +| `cocoapods` | CocoaPods version e.g. 0.29.0 | |
| 38 | +| `node` | Node version e.g. 16 | |
| 39 | +| `npm` | NPM version e.g. 8.19.2 | |
| 40 | +| `ndk` | NDK version e.g. 25.1.8937393 | |
| 41 | +| `java` | Java version e.g. 18 | |
| 42 | +| `ruby` | Ruby version e.g. 3.1.2 | |
| 43 | + |
| 44 | +Note that branch and tag names are inferred from the event that triggered the action. `branch` or `tag` arguments will override the values from the event. `tag` argument takes precedence over `branch` if both arguments are provided. |
| 45 | + |
| 46 | +Environment variables |
| 47 | +--------------------- |
| 48 | + |
| 49 | +Use the `CM_` prefix to pass environment variables to Codemagic builds. |
| 50 | + |
| 51 | +For example, define the `CM_FOO` variable in the GitHub Action step configuration: |
| 52 | + |
| 53 | + env: |
| 54 | + CM_FOO: bar |
| 55 | + |
| 56 | +The corresponding variable `FOO` (without the `CM_` prefix) will be available during the Codemagic build. |
| 57 | + |
| 58 | +Output variables |
| 59 | +---------------- |
| 60 | + |
| 61 | +Output variables can be used later in the action steps: |
| 62 | + |
| 63 | + - name: Build ID |
| 64 | + run: echo "${{ steps.build.outputs.build-id }}" |
| 65 | + |
| 66 | +| Output variable | Description | |
| 67 | +| ------------------ | ------------------------------------------------- | |
| 68 | +| `build-id` | Codemagic build ID | |
| 69 | +| `build-status-url` | Build status API endpoint | |
| 70 | +| `build-html-url` | Build page, requires Codemagic account for access | |
| 71 | + |
0 commit comments