Update and manage modules you created | Viam Documentation
Update and manage modules you created
After you create and upload a module, you can release new versions, pin machines to a specific version, set a minimum viam-server version, change visibility, deprecate, or delete the module.
Update a module
Once your module is in the registry, there are two ways to update it:
Update automatically using GitHub Actions: Recommended for ongoing projects with continuous integration (CI) workflows, or if you want to build for multiple platforms.
If you enabled cloud build when you generated your module, the GitHub Actions are already set up for you.
Update manually using the Viam CLI: Fine for small projects with one contributor.
Update automatically from a GitHub repo with cloud build
Use GitHub Actions to automatically build and deploy your new module version when you create a new release in GitHub:
- Edit your module code and update the
meta.jsonfile if needed.
For example, if you’ve changed the module’s functionality, update the description in themeta.jsonfile.
Important
Make sure the url field contains the URL of the GitHub repo that contains your module code.
This field is required for cloud build to work.
- Push your changes to your module GitHub repository.
Tip
If you used viam module generate to create your module and enabled cloud build, and you followed all the steps to deploy with cloud build including adding API keys for the build action, all you need to do to trigger a new build is publish a release in GitHub as you did when you first published the module.
- If you did not use the Viam CLI generator and enable cloud build, you can set up one of the following GitHub Actions up manually:
The build-action GitHub action provides a cross-platform build setup for multiple platforms: x86, ARM Linux, and macOS.
In your repository, create a workflow file called build.yml in the .github/workflows directory:
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: viamrobotics/build-action@v1
with:
version: ${{ github.ref_name }}
ref: ${{ github.sha }}
key-id: ${{ secrets.viam_key_id }}
key-value: ${{ secrets.viam_key_value }}
token: ${{ github.token }} # only required for private git repos
The build-action GitHub action relies on a build command that you need to specify in the meta.json file.
At the end of your meta.json, add the build configuration:
Cloud build configuration attributes
| Attribute | Inclusion | Description |
|---|---|---|
"setup" |
Optional | Command to run for setting up the build environment. |
"build" |
Required | Command to run to build the module tarball. |
"path" |
Optional | Path to the build module tarball. |
"arch" |
Required | Array of architectures to build for. For more information see Supported platforms for automatic updates. |
"darwin_deps" |
Required | Array of homebrew dependencies for Darwin builds. Explicitly pass [] for empty. Default: `[ |