Skip to content
4 changes: 3 additions & 1 deletion .claude/rules/project/terminology.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ One name per thing, in every kind of prose: documentation, chat, commit messages
| The CLI tool | `bv` | the tool, Buildvana CLI tool, the Buildvana tool |
| The shared library package | `Buildvana.Runtime` | the runtime |
| The directory Buildvana works from | home directory | repository root, solution directory |
| Where `bv` runs, as `CIPlatform` detects it: GitHub Actions, GitLab CI, Generic CI, or Local | CI platform | build platform, cloud build, CI provider |
| Where `bv` runs, as `CIPlatform` detects it, listed below the table | CI platform | build platform, cloud build, CI provider |
| The service that hosts the repository `repository.url` names, such as GitHub | Git host | server, Git server |
| The remote of the clone whose URL names the repository `repository.url` names | release remote | upstream remote, `origin` |
| The configuration file, in either spelling | `buildvana.jsonc` | `buildvana.json`, the configuration file |
Expand All @@ -34,4 +34,6 @@ One name per thing, in every kind of prose: documentation, chat, commit messages
| An `InternalAPI.Shipped.txt` or `InternalAPI.Unshipped.txt` file | internal API file | |
| The public API files and the internal API files together | declared API files | API files |

The CI platforms are GitHub Actions, GitLab CI, Gitea Actions, Forgejo Actions, Generic CI, and Local.

`buildvana.jsonc` stands for either spelling because the name reminds the reader that comments and trailing commas are accepted. The page about the configuration file says that `buildvana.json` is accepted too.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ The patch number restarted from 1, below the 2.0.x versions already published.
- `bv release` fetches the tags of the [release remote](docs/tool-commands/release.md#the-release-remote) before it checks the versions.
- `release.allowUnknownHost` lets `bv release` [tag and push without a release page](docs/tool-commands/release.md#publishing-on-an-unknown-host) on a Git host `bv` does not know.
- `bv release` [publishes on GitLab](docs/tool-commands/release.md#publishing-on-gitlab), with the assets in the generic package registry of the project, and `hosts.gitlab.tokenEnv` names the token variable.
- `bv release` [publishes on Gitea](docs/tool-commands/release.md#publishing-on-gitea), with the assets as attachments of the release, and `hosts.gitea.tokenEnv` names the token variable.
- `bv release` [publishes on Forgejo](docs/tool-commands/release.md#publishing-on-forgejo), with the assets as attachments of the release, and `hosts.forgejo.tokenEnv` names the token variable.
- `bv` recognizes [Gitea Actions](docs/environment-variables.md#gitea_actions) as a CI platform, with the `gitea-actions` bot identity and the `version` step output of `bv release`.
- `bv` recognizes [Forgejo Actions](docs/environment-variables.md#forgejo_actions) as a CI platform, with the `forgejo-actions` bot identity and the `version` step output of `bv release`.
- `bv release` takes a host whose name ends in `.ghe.com` for [GitHub Enterprise Cloud with data residency](docs/tool-commands/release.md#publishing-on-github), whose API is at `https://api.<host>`.
- [`bv info`](docs/tool-commands/info.md) prints the CI platform, the Git host, the release remote, and the identity a release would use.

Expand Down
12 changes: 12 additions & 0 deletions buildvana.example.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,18 @@
// Name of the environment variable that holds the GitLab access token.
"tokenEnv": "GITLAB_TOKEN",
},

// Configuration for the Gitea host.
"gitea": {
// Name of the environment variable that holds the Gitea access token.
"tokenEnv": "GITEA_TOKEN",
},

// Configuration for the Forgejo host.
"forgejo": {
// Name of the environment variable that holds the Forgejo access token.
"tokenEnv": "FORGEJO_TOKEN",
},
},

// Configuration for Git-related behavior.
Expand Down
4 changes: 3 additions & 1 deletion docs/configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ A setting whose member names are data, such as `dependencies.policies` and `dotn
| ------------------------------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `$schema` | none | The URL of the JSON schema, whose version segment [`bv self-update`](tool-commands/self-update.md#what-the-command-updates) moves with the other pins. |
| `repository.url` | none | The URL of the repository that [`bv release`](tool-commands/release.md#preconditions) publishes to, and without it `bv release` fails. |
| `repository.host` | `auto` | The [kind of Git host](tool-commands/release.md#preconditions) of the repository: `auto`, `github`, or `gitlab`. |
| `repository.host` | `auto` | The [kind of Git host](tool-commands/release.md#preconditions) of the repository: `auto`, `github`, `gitlab`, `gitea`, or `forgejo`. |
| `release.branches` | none | The regular expressions of the branches that produce [public releases](sdk-modules/versioning.md#releasebranches-setting), and by default no branch does. |
| `release.configuration` | `dotnet.configuration` | The [build configuration of `bv release`](tool-commands/release.md#the-build-configuration). |
| `release.checkPublicApi` | `true` | Whether the public API files take part in [the version spec change](tool-commands/release.md#the-version-spec-change) of `bv release`. |
Expand Down Expand Up @@ -115,6 +115,8 @@ A setting whose member names are data, such as `dependencies.policies` and `dotn
| `nuget.feeds.release.apiKeyEnv` | none | The environment variable holding the [API key](environment-variables.md#secret-carrying-variables-named-by-the-configuration-file) of the release feed. |
| `hosts.github.tokenEnv` | `GITHUB_TOKEN` | The environment variable holding the [GitHub token](environment-variables.md#secret-carrying-variables-named-by-the-configuration-file) of the release operations. |
| `hosts.gitlab.tokenEnv` | `GITLAB_TOKEN` | The environment variable holding the [GitLab token](environment-variables.md#secret-carrying-variables-named-by-the-configuration-file) of the release operations. |
| `hosts.gitea.tokenEnv` | `GITEA_TOKEN` | The environment variable holding the [Gitea token](environment-variables.md#secret-carrying-variables-named-by-the-configuration-file) of the release operations. |
| `hosts.forgejo.tokenEnv` | `FORGEJO_TOKEN` | The environment variable holding the [Forgejo token](environment-variables.md#secret-carrying-variables-named-by-the-configuration-file) of the release operations. |
| `git.identity.name` | none | The name of the [author of the commits of `bv release`](tool-commands/release.md#preconditions). |
| `git.identity.email` | none | The email address of the [author of the commits of `bv release`](tool-commands/release.md#preconditions). |
| `dependencies.scopes.netsdk` | `major` | The [update policy](tool-commands/dependencies.md#update-policies) of the `netsdk` scope, the .NET SDK version in `global.json`. |
Expand Down
71 changes: 64 additions & 7 deletions docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ The variables that the .NET SDK, MSBuild, and NuGet read are out of scope, and t
- [`DOTNET_CLI_CONSOLE_USE_DEFAULT_ENCODING`](#dotnet_cli_console_use_default_encoding)
- [`DOTNET_CLI_HOME`](#dotnet_cli_home)
- [`DOTNET_HOST_PATH`](#dotnet_host_path)
- [`FORGEJO_ACTIONS`](#forgejo_actions)
- [`FORGEJO_OUTPUT`](#forgejo_output)
- [`FORGEJO_SERVER_URL`](#forgejo_server_url)
- [`GITEA_ACTIONS`](#gitea_actions)
- [`GITHUB_ACTIONS`](#github_actions)
- [`GITHUB_OUTPUT`](#github_output)
- [`GITHUB_SERVER_URL`](#github_server_url)
Expand Down Expand Up @@ -96,6 +100,44 @@ The `dotnet` muxer sets it on every process it starts, with the full path of the
The variable is unset when `bv` runs through the native shim of a global tool.
`bv` then runs the `dotnet` found on the `PATH`.

### `FORGEJO_ACTIONS`

The Forgejo runner sets it to `true` on every step, from Forgejo Runner 7.0.0.
`bv` reads it to recognize the Forgejo Actions [CI platform](introduction.md#ci-platforms).
The step output of `bv release` then goes to the file `FORGEJO_OUTPUT` names.
The `forgejo-actions` identity authors the commits of `bv release`, unless `buildvana.jsonc` states a `git.identity`.
The comparison ignores case.

The Forgejo runner also sets `GITHUB_ACTIONS`, and Forgejo Runner 7 to 12 set `GITEA_ACTIONS`.
`bv` reads `FORGEJO_ACTIONS` before both, so such a run is a Forgejo Actions run.

### `FORGEJO_OUTPUT`

The Forgejo runner sets it to the path of the file that collects the outputs of a step, from Forgejo Runner 9.0.0.
On Forgejo Actions, `bv release` appends the released version to that file as the `version` step output.
When the variable is unset, the release fails before creating anything.
`bv release` therefore needs Forgejo Runner 9.0.0 or later.
`bv` never sets the variable.

### `FORGEJO_SERVER_URL`

The Forgejo runner sets it to the URL of the Forgejo instance that runs the job, from Forgejo Runner 9.0.0.
When `repository.url` names a repository on the host of that URL, `bv release` takes the host for Forgejo.
A self-hosted Forgejo instance is recognized this way on its own runners.
The variable matters only together with `FORGEJO_ACTIONS`.

### `GITEA_ACTIONS`

The Gitea runner sets it to `true` on every step.
`bv` reads it to recognize the Gitea Actions [CI platform](introduction.md#ci-platforms).
The step output of `bv release` then goes to the file `GITHUB_OUTPUT` names.
The `gitea-actions` identity authors the commits of `bv release`, unless `buildvana.jsonc` states a `git.identity`.
Its address is `gitea-actions@noreply.<host>`, with the host name of `GITHUB_SERVER_URL`.
The comparison ignores case.

The Gitea runner also sets `GITHUB_ACTIONS`, and `bv` reads `GITEA_ACTIONS` first.
Forgejo Runner 7 to 12 set `GITEA_ACTIONS` too, and `bv` reads `FORGEJO_ACTIONS` before it.

### `GITHUB_ACTIONS`

GitHub Actions sets it to `true` on every step.
Expand All @@ -105,19 +147,26 @@ The `github-actions[bot]` identity authors the commits of `bv release`, unless `
The comparison ignores case, so `TRUE` and `True` count too.
Any other value, or no value, means no GitHub Actions.

The Gitea runner and the Forgejo runner set it too.
`bv` reads `FORGEJO_ACTIONS` and `GITEA_ACTIONS` before it, so such a run is not a GitHub Actions run.

### `GITHUB_OUTPUT`

GitHub Actions sets it to the path of the file that collects the outputs of a step.
`bv release` appends the released version to that file as the `version` step output, for the later steps of the job.
GitHub Actions and the Gitea runner set it to the path of the file that collects the outputs of a step.
On GitHub Actions and on Gitea Actions, `bv release` appends the released version to that file as the `version` step output.
When the variable is unset, the release fails before creating anything.
`bv` never sets the variable.

Recent Gitea runners also set `GITEA_OUTPUT` to the same path.
`bv` reads `GITHUB_OUTPUT`, because every Gitea runner sets it.

### `GITHUB_SERVER_URL`

GitHub Actions sets it to the URL of the GitHub instance that runs the job, such as `https://github.com`.
When `repository.url` names a repository on the host of that URL, `bv release` takes the host for GitHub.
A GitHub Enterprise Server is recognized this way on its own runners.
The variable matters only together with `GITHUB_ACTIONS`.
GitHub Actions and the Gitea runner set it to the URL of the instance that runs the job, such as `https://github.com`.
When `repository.url` names a repository on the host of that URL, `bv release` takes the host for GitHub on GitHub Actions.
On Gitea Actions, it takes the host for Gitea.
A GitHub Enterprise Server, or a self-hosted Gitea instance, is recognized this way on its own runners.
The variable matters only together with `GITHUB_ACTIONS` or `GITEA_ACTIONS`.

### `GITLAB_CI`

Expand All @@ -143,7 +192,7 @@ On Windows, a console mode answers the question, and `bv` does not read `TERM`.
### Variables that mark a CI runner

`bv` recognizes a CI runner as the .NET CLI does.
When neither `GITLAB_CI` nor `GITHUB_ACTIONS` selects a [CI platform](introduction.md#ci-platforms), any of these makes the run a Generic CI run:
When none of `GITLAB_CI`, `FORGEJO_ACTIONS`, `GITEA_ACTIONS`, and `GITHUB_ACTIONS` selects a [CI platform](introduction.md#ci-platforms), any of these makes the run a Generic CI run:

- `TF_BUILD`, `GITHUB_ACTIONS`, `APPVEYOR`, `CI`, `TRAVIS`, or `CIRCLECI`, set to `1`, `true`, `yes`, or `on`, in any case;
- `CODEBUILD_BUILD_ID` and `AWS_REGION`, both non-empty;
Expand All @@ -168,6 +217,14 @@ The [configuration file](configuration-file.md) names the environment variable t
The token is also the password of the fetch and the push of `bv release`.
The default name is `GITLAB_TOKEN`.
The name `CI_JOB_TOKEN` selects the job token of GitLab CI, as [Publishing on GitLab](tool-commands/release.md#publishing-on-gitlab) says.
- `hosts.gitea.tokenEnv` names the variable holding the Gitea token of the release operations.
The token is also the password of the fetch and the push of `bv release`.
The default name is `GITEA_TOKEN`.
On Gitea Actions, the workflow sets the variable, as [Publishing on Gitea](tool-commands/release.md#publishing-on-gitea) says.
- `hosts.forgejo.tokenEnv` names the variable holding the Forgejo token of the release operations.
The token is also the password of the fetch and the push of `bv release`.
The default name is `FORGEJO_TOKEN`.
On Forgejo Actions, the runner sets that variable to the token of the job, as [Publishing on Forgejo](tool-commands/release.md#publishing-on-forgejo) says.
- `nuget.feeds.release.apiKeyEnv` and `nuget.feeds.prerelease.apiKeyEnv` name the variables holding the API keys of the NuGet push feeds.

---
Expand Down
16 changes: 10 additions & 6 deletions docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ Each table below states a status for every item.
| GitHub Enterprise Cloud with data residency | Supported (untested) | SourceLink needs a `SourceLinkGitHubHost` item, with `ContentUrl` set to `https://raw.<host>`. |
| GitLab | Supported (untested) | |
| Self-managed GitLab | Supported (untested) | SourceLink needs a `SourceLinkGitLabHost` item. |
| Gitea | Supported (untested) | SourceLink needs a `Microsoft.SourceLink.Gitea` reference and a `SourceLinkGiteaHost` item. |
| Forgejo | Supported (untested) | SourceLink needs a `Microsoft.SourceLink.Gitea` reference and a `SourceLinkGiteaHost` item. |
| Other Git hosts | Supported with limits | Buildvana SDK does not configure SourceLink.<br>`bv release` creates no release page, and runs only with [`release.allowUnknownHost`](tool-commands/release.md#publishing-on-an-unknown-host). |

### CI platforms
Expand All @@ -105,12 +107,14 @@ Generic CI is any other runner that the .NET CLI recognizes as one.
Local is a machine where `bv` recognizes no CI runner, such as a developer machine.
Every CI platform runs every command, `bv release` included.

| CI platform | Status |
| ---------------------------------------------------------------------- | -------------------- |
| GitHub Actions | Supported |
| GitLab CI | Supported (untested) |
| [Generic CI](environment-variables.md#variables-that-mark-a-ci-runner) | Supported (untested) |
| Local | Supported (untested) |
| CI platform | Status | Limits |
| ---------------------------------------------------------------------- | -------------------- | -------------------------------------------------------------------------------------------- |
| GitHub Actions | Supported | |
| GitLab CI | Supported (untested) | |
| Gitea Actions | Supported (untested) | |
| Forgejo Actions | Supported (untested) | `bv release` needs [Forgejo Runner 9.0.0 or later](environment-variables.md#forgejo_output). |
| [Generic CI](environment-variables.md#variables-that-mark-a-ci-runner) | Supported (untested) | |
| Local | Supported (untested) | |

### Toolchain

Expand Down
Loading
Loading