Automating CodePush Releases with GitLab CI/CD
DeployPulse works seamlessly with GitLab CI/CD. This guide shows how to configure a .gitlab-ci.yml pipeline that releases OTA updates to DeployPulse automatically whenever you push to your release branches.
Prerequisites
- A DeployPulse account and app already created
DEPLOYPULSE_ACCESS_KEYstored as a GitLab CI/CD variable (mark it Masked to hide it from job logs)
.gitlab-ci.yml Example
The example below releases to Production from main and to Staging from develop. dpctl picks up DEPLOYPULSE_ACCESS_KEY from the environment automatically.
image: node:20
stages:
- release
.release-base:
stage: release
before_script:
- npm ci
- git clone https://github.com/deploypulseio/dpctl dpctl
- cd dpctl && npm install && npm run build && npm install -g && cd ..
release-production:
extends: .release-base
script:
- dpctl release-react MyApp-iOS ios
--deployment Production
--dev false
only:
- main
release-staging:
extends: .release-base
script:
- dpctl release-react MyApp-iOS ios
--deployment Staging
--dev false
only:
- develop
Add a second job pair for Android by changing ios to android and updating the app name.
Staged Rollout
Pass --rollout to release to a subset of users first:
release-production:
extends: .release-base
script:
- dpctl release-react MyApp-iOS ios
--deployment Production
--dev false
--rollout 20
only:
- main
Promote to a wider rollout from the dashboard or with dpctl patch once you are satisfied.
Code Signing
Store your private key as a GitLab file variable (CODE_SIGNING_KEY_FILE), then reference it directly:
release-production:
extends: .release-base
script:
- dpctl release-react MyApp-iOS ios
--deployment Production
--private-key "$CODE_SIGNING_KEY_FILE"
--dev false
only:
- main
See the Code Signing guide for key generation and app configuration.
