Newer
Older
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. |
```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="<personal-access-token>"
npm install --save-dev @semantic-release/bzlmod
```yaml
plugins:
- "@semantic-release/bzlmod"
```
By default the plugin will locate `MODULE.bazel` in the current package root `.`
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`.
It *must* be performed _after_ the `@semantic-release/git` to generate the correct integrity for the source tarball.
The `prefix` and `url` must be specified:
```yaml
plugins:
- "@semantic-release/bzlmod"
- path: "@semantic-release/git"
assets:
- MODULE.bazel
- path: "@semantic-release/bzlmod"
source:
prefix: ${CI_PROJECT_NAME}-v${version}
url: ${CI_PROJECT_URL}/-/archive/v${version}/${CI_PROJECT_NAME}-v${version}.tar
```
This will generate a `source.json` that can be uploaded as part of a GitLab release:
```yaml
plugins:
- path: "@semantic-release/gitlab"
- 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