Publish or upgrade a Sui Move smart contract package using the Sui CLI. This action automates the deployment process, handling both new deployments and upgrades based on the specified strategy.
Note
As this action uses the Sui CLI under the hood, it will update the Published.toml file in-place to reflect the new package ID after deployment. Make sure to commit the updated Published.toml file back to your repository if you want to keep it in sync with the deployed contract.
This action requires setup-sui-cli to run first, with a funded deployer wallet configured for the target network.
| Input | Default | Description |
|---|---|---|
dir |
. |
Directory containing Published.toml and Move package files. |
env |
testnet |
Target Sui environment in the Published.toml file. |
rpc-url |
- | Optional RPC URL override. If omitted, uses the official endpoint for the selected environment. |
verify-deps |
true |
Pass --verify-deps to Sui CLI publish/upgrade to verify dependency source code. |
deploy-mode |
auto |
Deployment strategy: auto, force-publish, or safe-upgrade-only. |
The rpc-url input controls which RPC endpoint is used for deployment:
- If specified: The provided URL is used, overriding the default.
- If omitted: Uses the official Sui CLI RPC endpoint based on the
envparameter:mainnet:https://fullnode.mainnet.sui.io:443testnet(default):https://fullnode.testnet.sui.io:443- Other environments fall back to the
testnetendpoint.
auto(default): IfPublished.tomlcontains anupgrade-capabilityfor the selectedenv, the action attempts an upgrade. If upgrade compatibility checks fail, it falls back to publishing a new package.force-publish: Ignores any existing published entry for the selectedenvand always publishes a new package.safe-upgrade-only: Same asautomode, but if compatibility checks failed, it will error out, ensuring that no unintended new package is published.
| Output | Description |
|---|---|
digest |
Transaction digest. |
upgrade-cap |
Upgrade capability object ID used for package upgrades. |
published-package-id |
Package ID after publish/upgrade. |
published-type |
Publish result type, either new or upgraded. |
previous-package-id |
Empty when newly published; same as published-package-id when upgraded; holds the previous package ID when force-publish was used. |
Setup Sui CLI and deploy:
- name: 📦 Setup Sui CLI
uses: CommandOSSLabs/setup-sui-cli@v1
with:
network: testnet
private_key: ${{ secrets.SUI_DEPLOYER_PRIVATE_KEY }}
- name: 🚀 Deploy Sui smart contract
uses: CommandOSSLabs/deploy-sui-smart-contract@v1
with:
dir: ./move
env: testnetDeploy with custom RPC URL:
- name: 🚀 Deploy Sui smart contract
uses: CommandOSSLabs/deploy-sui-smart-contract@v1
with:
dir: ./move
env: testnet
rpc-url: https://fullnode.testnet.sui.io:443This project is licensed under the Apache License 2.0.