phala deploy --json --wait, and reports the result as workflow outputs. You do not write any CLI commands yourself.
Use it when you want the shortest path from a push to a deployed CVM. If you need to build images, run extra steps, or use another CI system, see Set Up a CI/CD Pipeline.
What do I need before I start?
- A
phala.tomlfile at the root of your repository. The action stops with an error if the file is missing. It tells the CLI which CVM to update. See phala.toml Configuration. - A Docker Compose file in the repository. The CLI reads it the same way it does for
phala deploy. - A Phala Cloud API key.
- An
actions/checkoutstep before the action, so the files are on the runner.
ubuntu-latest runners already work.
How do I add the API key?
Store the key as a repository secret. Do not put it in the workflow file.- In your GitHub repository, open Settings > Secrets and variables > Actions.
- Select New repository secret.
- Name it
PHALA_API_KEYand paste your Phala Cloud API key.
What does a minimal workflow look like?
paths filter under push:
What are the inputs?
What are the outputs?
Read outputs from a step that has anid, for example steps.deploy.outputs.status.
status, app-id, vm-uuid, cvm-name, and dashboard-url come straight from the deploy result. The hash, OS image, kms-type, and device-id outputs come from a second request for the CVM’s details, which the action makes with your API key. If that request fails, the deploy still counts as successful, the action prints a warning, and those outputs are empty.
When does the job succeed or fail?
When the deployment is an update, the job waits for the real result. It does not stop after the update request is accepted.- Update finishes: the job succeeds with
status=success. - Update fails or is cancelled: the job fails with
status=failed, and the deploy output is printed in the job log. - Wait takes too long: the CLI waits up to 5 minutes for an update. After that the job fails, but the update may still be running. Check the CVM in the dashboard before you re-run the workflow.
- Stopped CVM: the job waits for the CVM to return to the state it was in before the update. A stopped CVM stays stopped.
phala deploy -n <name> -c docker-compose.yml, and put its name in phala.toml. Then let the action update it on each push.
A new CVM keeps booting after the command that creates it returns, so do not expect a first deployment to wait until the CVM is running. Open the CVM in the dashboard to follow it.
Updating a CVM that is in error status is not supported yet. A fix is planned for the next CLI release. Until then, do not rely on the action to update a CVM in that state.
What happens when nothing changed?
If the configuration, compose file, and environment variables match what is already deployed, the job succeeds right away. The CVM is not restarted.What if the CVM uses on-chain KMS?
An update to a CVM that uses on-chain KMS must be approved on-chain before it takes effect. The job does not fail in this case. It ends withstatus=pending_approval, prints the compose hash as a warning, and sets compose-hash and commit-token. Approve the update in the dashboard. Do not treat this status as a finished deployment.
How do I pass environment variables and secrets?
Use theenvs input. Put one KEY=VALUE on each line, and take every value from a GitHub secret.
.env file on the runner and passes it to the deploy. The CLI encrypts the values before it sends them, so they reach your CVM as encrypted secrets. Use a repository secret for each value. Never type a secret directly into the workflow file.
Which CLI version should I use?
Leavecli-version unset. The action installs the version it was tested with, which is 1.2.2. Because the action pins the version, a new CLI release does not change your deployments until you change the input.
To use a different release, set the input to an exact version:
1.2.1 or newer. Older versions do not wait correctly on stopped CVMs and do not check the update result with keyless login.
Keyless login with GitHub OIDC (Beta)
Keyless login lets a workflow deploy without an API key. GitHub gives the job a short-lived token, and Phala Cloud accepts it from a GitHub repository that you registered for the app. This feature is in Beta. It is enabled per workspace, so contact support to turn it on for yours. To use it:- Ask support to enable it for your workspace.
- Open your app in the dashboard and go to GitHub. This item appears only after support has enabled the feature.
- Under GitHub repository, enter the repository that may deploy this app, in
owner/repoformat, and select Save. Phala Cloud asks you to confirm with a fresh two-factor verification when you save. You cannot save it with an API key. - Give the workflow the
id-token: writepermission, andcontents: readfor checkout. - Leave out
api-key.
refs/heads/main. Only this workflow limits deploys to one workflow. Each app trusts one repository, and saving a new one replaces the old one. Select Remove to stop that repository from deploying the app.
workspace input to the one you want. If you pass both an api-key and the permission, the CLI uses the API key.
With keyless login the action reads the result from the deploy response only. The compose hash, OS image, kms-type, and device-id outputs are empty. oidc-repository and oidc-commit-sha are filled in only when the API returns them, so they can be empty too.
Troubleshooting
The job saysphala.toml not found. Add phala.toml to the repository root, and make sure actions/checkout runs before the action.
The job says no authentication method is available. Pass api-key and check that the secret name matches the one you created. For keyless login, check that the workflow has the id-token: write permission.
The job fails after about 5 minutes. The update may still be running. Open the CVM in the dashboard and check its status before you run the workflow again.
An output is empty. Hash, OS image, kms-type, and device-id outputs are filled in only when the action could fetch the CVM’s details. Look for a warning in the job log.
