Skip to content

CI/CD

Any CI that runs Node.js can deploy with the CLI. It needs two things: a credential, and the project to deploy to.

1. Create an API key

In the dashboard, open the workspace's Settings → API keys and create a key with the developer role. Only owners and admins can create keys, and the key's value is shown once: copy it.

Store it in your CI's secrets as HIRAISHIP_TOKEN.

2. Deploy with --project

CI has no terminal to answer prompts, and the .hiraiship link isn't committed. Name the project instead:

Terminal
npx @hiraiship/cli deploy --project my-app

The command exits with 1 when the build or its publication fails, which fails the job.

GitHub Actions

.github/workflows/deploy.yml
name: Deploy
 
on:
  push:
    branches: [main]
 
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
 
      - uses: actions/setup-node@v4
        with:
          node-version: 22
 
      - run: npx @hiraiship/cli deploy --project my-app
        env:
          HIRAISHIP_TOKEN: ${{ secrets.HIRAISHIP_TOKEN }}

There's no install or build step in the job: Hiraiship installs and builds on its own machines.

Other CI systems

The same command works anywhere, as long as HIRAISHIP_TOKEN is set:

.gitlab-ci.yml
deploy:
  image: node:22
  script:
    - npx @hiraiship/cli deploy --project my-app
  only:
    - main

Without the CLI

A pipeline that can't run Node.js can make the same requests itself, with the same key: see Deploy without the CLI. The API section covers rollbacks, variables and domains too.

Good practice

  • One key per pipeline, so you can revoke one without breaking the others.
  • Use --verbose to keep the full build log in the job's output.
  • Use --no-wait when the job shouldn't wait for the build, and check the deployment in the dashboard instead. The job then succeeds as soon as the build starts.