Automated deployment of static websites to Walrus decentralized storage using GitHub Actions.
-
Setup Repository Secrets
- Go to your repository Settings → Secrets and variables → Actions
- Add the following secrets:
SUI_PRIVATE_KEY: Your Sui wallet private key (base64 encoded) SUI_ADDRESS: Your Sui wallet address (e.g., 0x1234...)
-
Prepare Your Site
- Ensure your build process outputs static files to
./dist - The workflow will auto-detect and build npm projects
- Ensure your build process outputs static files to
-
Deploy
- Automatic: Push to
mainbranch triggers deployment to testnet - Manual: Use "Actions" tab → "Deploy to Walrus" → "Run workflow"
- Automatic: Push to
If you need to set up a new Sui wallet:
# Install Sui CLI
curl -fsSL https://raw.githubusercontent.com/MystenLabs/sui/main/scripts/install.sh | bash
# Create new wallet
sui client new-address ed25519
# Get your address
sui client active-address
# Export private key (for GitHub secrets)
sui keytool export --keystore-path ~/.sui/sui_config/sui.keystore --address YOUR_ADDRESSThe workflow uses configuration files in the config/ directory:
config/walrus-client.yaml: Walrus client configuration for both networksconfig/walrus-site.yaml: Site deployment settings and package addresses
These files contain public blockchain addresses and can be safely committed to your repository.
- Testnet (default): Free, for testing and development
- Mainnet: Production deployments (requires SUI tokens for gas)
- Testnet: 1 epoch = 2 days
- Mainnet: 1 epoch = 14 days
- Default: 5 epochs (10 days testnet / 70 days mainnet)
# Triggers on push to main branch
git push origin mainUse the GitHub Actions interface with custom parameters:
- Network: Choose testnet or mainnet
- Epochs: Set storage duration
- Force Rebuild: Override cache and rebuild
After successful deployment, you'll get:
- Site URL: Direct link to your deployed site
- Deployment ID: Unique identifier for this deployment
- Storage Duration: Confirmation of epoch setting
- Expiration Date: When the deployment expires
If your project doesn't use npm, modify the workflow's build steps:
- name: Custom Build
run: |
# Your custom build commands here
# Ensure output goes to ./distFor mainnet deployments, you can adjust gas settings in config/walrus-site.yaml:
general:
gas_budget: 500000000 # Adjust as needed- ✅ Configuration files contain only public addresses
- ✅ Private keys are stored securely in GitHub Secrets
- ✅ Testnet deployments use free faucet tokens
⚠️ Mainnet deployments require real SUI tokens
"./dist directory not found"
- Ensure your build process creates a
./distdirectory - Check that build commands in the workflow match your project
"SUI_PRIVATE_KEY and SUI_ADDRESS secrets must be set"
- Add the required secrets in repository settings
- Ensure private key is base64 encoded
"Insufficient balance"
- For testnet: Workflow automatically requests from faucet
- For mainnet: Fund your wallet with SUI tokens
Deployment fails with gas errors
- Check wallet balance:
sui client gas - For testnet: Workflow will auto-fund
- For mainnet: Add more SUI tokens to your wallet
- Check the Walrus documentation
- Review workflow logs in the Actions tab
- Verify your configuration files match the expected format
Walrus is a decentralized storage network built on the Sui blockchain. It provides:
- Decentralized hosting: No single point of failure
- Cost-effective storage: Pay once for epoch-based storage
- Permanent URLs: Your content remains accessible via consistent URLs
- Blockchain security: Leverages Sui's security guarantees
Sites deployed to Walrus are accessible via:
- Testnet:
https://your-id.buildonwalrus.dev - Mainnet:
https://your-id.walrus.site
This automation workflow transforms the manual deployment process into a seamless CI/CD pipeline, making it easy to deploy and maintain your static sites on Walrus.