Github Releases
How to deploy an app to Github Releases using codemagic.yaml
Publishing GitHub releases is available for GitHub repositories only.
This guide only applies to workflows configured with the codemagic.yaml.
Publishing happens only for successful builds triggered on tag creation and is unavailable for manual builds.
As of deprecating the GitHub OAuth integration, Codemagic no longer has write access to the repositories. Setting up a personal access token is needed to publish releases to GitHub. Please follow the instructions below.
- Create a personal access token in GitHub as described here.
- Add the personal access token as an environment variable with the name
GITHUB_TOKEN
in theenvironment
section. - In the
triggering
section, configure triggering on tag creation. Don’t forget to add a branch pattern and ensure the webhook exists.
triggering:
events:
- tag
Add the following script after the build or publishing scripts that publish the artifacts with tag builds. Edit the placeholders like your application name and the path to build artifacts to match your setup.
#!/usr/bin/env zsh # Publish only for tag builds if [ -z ${CM_TAG} ]; then echo "Not a tag build will not publish GitHub release" exit 0 fi # See more options about `gh release create` usage from GitHub CLI # official docs at https://cli.github.com/manual/gh_release_create gh release create "${CM_TAG}" \ --title "<Your Application Name> ${CM_TAG}" \ --notes-file changelog.md \ path/to/build-artifact.ipa \ path/to/build-artifact.apk # Note that you don't need to include title and changelog if you do not want to. # Any number of artifacts can be included with the release.