# bzlmod A `semantic-release` plugin to update the bazel module version specified in `MODULE.bazel` | Step | Description | | ---- | ----------- | | verifyConditions | Verify that `MODULE.bazel` exists, `module.version` is specified in it and is writable. | | prepare | Updates the version specified by `module.version` following semantic versioning. | ## Getting Started ```sh npm config set always-auth true npm config set @semantic-release:registry https://gitlab.gpu.arm.com/api/v4/packages/npm/ npm config set -- '//gitlab.gpu.arm.com/api/v4/packages/npm/:_authToken' '${GITLAB_TOKEN}' export GITLAB_TOKEN="" npm install --save-dev @semantic-release/bzlmod ``` Add the following to `.releaserc.yaml`: ```yaml plugins: - "@semantic-release/bzlmod" ``` ## Configuration By default the plugin will locate `MODULE.bazel` in the current package root `.` ### `filepath` The path to `MODULE.bazel` can be specified in the plugin configuration. For example, to specify `MODULE.bazel` in `./custom/`, do: ```yaml plugins: - path: "@semantic-release/bzlmod" filepath: - "./custom/MODULE.bazel" ``` ### `source` The plugin can automatically create a `source.json` which can be used to integrate with `bzlmod`. The `prefix` and `url` must be specified: ```yaml plugins: - path: "@semantic-release/bzlmod" source: prefix: ${CI_PROJECT_NAME}-${nextRelease.version} url: ${CI_PROJECT_URL}/-/archive/${CI_PROJECT_NAME}/${version}/${CI_PROJECT_NAME}-${version}.tar ``` This will generate a `source.json` that can be uploaded as part of a GitLab release: ```yaml plugins: - path: "@semantic-release/gitlab" assets: - path: MODULE.bazel type: package filepath: /modules/${env.CI_PROJECT_NAME}/${nextRelease.version}/MODULE.bazel - path: source.json type: package filepath: /modules/${env.CI_PROJECT_NAME}/${nextRelease.version}/source.json ``` `bzlmod` can then be pointed directly at the GitLab release to use the project. Set the `--registry` to the release URL. [bzlmod]: https://bazel.build/build/bzlmod