HotCodePush
CI/CDProviders

GitHub Actions

A release.yml that releases every merge to production with the HotCodePush release action, with the bare CLI line beside it.

To ship every commit from GitHub Actions, a workflow on push to main builds the app and runs the release action with two repository secrets. The hotcodepush-team/release-action step wraps the pinned HotCodePush CLI and masks the token and the key. Its inputs are the flags of release create under the same names.

Ship every commit has the prerequisites and the three disciplines. This page carries the GitHub Actions file.

Secrets to set

Both live under the repository's Settings › Secrets and variables › Actions. A job that names environment: production reads them from a GitHub Environment of that name instead, which keeps the key to the jobs you put there.

SecretHolds
HOTCODEPUSH_TOKENHolds an API token from the console's API tokens page.
HOTCODEPUSH_SIGNING_KEYHolds the content of the private key file signing-key create wrote, PEM lines included. Leave it out until the app has a key.

A pull request from a fork gets no secrets. In a pull request job that releases, such as the preview workflow, guard the job with if: github.event.pull_request.head.repo.full_name == github.repository when the repository takes outside contributions.

The workflow

.github/workflows/release.yml
name: Release to production
on:
  push:
    branches: [main]
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Check out the commit
        uses: actions/checkout@v7
      - name: Build the web app
        run: npm ci && npm run build
      - name: Release to production
        uses: hotcodepush-team/release-action@v0.1.0
        with:
          token: ${{ secrets.HOTCODEPUSH_TOKEN }}
          private-key: ${{ secrets.HOTCODEPUSH_SIGNING_KEY }}
          channel: production

Every input is a flag of release create under the same name. An input left empty passes no flag, so the CLI's defaults apply. The inputs a pipeline reaches for:

  • rollout-percent: 10 with progression: true stages the release.
  • bundle-version: ${{ github.sha }} names the bundle by the commit.
  • dry-run: true serves a pull request check that needs no key.
  • path points at a build that lands outside the framework's default directory.
  • working-directory serves an app in a monorepo.
  • cli-version runs another CLI version.

The action's README lists them all. The step's outputs name what it released: release-number, channel-id, bundle-number and the whole answer as releases.

  • A React Native or Expo app replaces the build step with npm ci alone: the CLI packages the bundle per platform inside the upload. A Cordova app whose www is written by hand has no build step either.
  • The runner's Node.js must be 22 or later, and GitHub-hosted runners ship it.

The release step logs one line per release and writes a job summary: channel, number, bundle and rollout. A failed release fails the step with the CLI's exit code and an annotation titled with the code, and the error catalog names the fix. A green job and a device that did not take the release is the other case. See Troubleshooting.

A preview channel per pull request runs from the same pipeline, with a QR code in a pull request comment. Test with preview channels has that workflow.

Next steps

Last updated on

On this page