mirror of
https://gitea.com/gitea/docs.git
synced 2026-11-04 17:19:52 +00:00
Adds a CLI product for gt (https://gitea.com/gitea/cli), set up like the runner, with short guides for installation, logging in, CI and scripting. Each command's details stay in gt <command> --help. Until the first release, the docs are served at /cli/; make cut-version PRODUCT=cli VERSION=0.1 adds the release series. Closes https://gitea.com/gitea/cli/issues/16 <!-- cloudflare-preview --> Preview: https://pr-603.docs-gitea-com.pages.dev --------- Co-authored-by: silverwind <[email protected]> Reviewed-on: https://gitea.com/gitea/docs/pulls/603 Reviewed-by: Lunny Xiao <[email protected]> Reviewed-by: silverwind <[email protected]>
41 lines
1.0 KiB
Markdown
41 lines
1.0 KiB
Markdown
---
|
|
sidebar_position: 4
|
|
---
|
|
|
|
# Using gt in CI
|
|
|
|
Give gt a token and an instance through the environment, and turn prompts off:
|
|
|
|
| Variable | Description |
|
|
| --- | --- |
|
|
| `GITEA_TOKEN` | Access token; gt never stores it |
|
|
| `GITEA_CLI_HOST` or `GITEA_INSTANCE_URL` | URL of the instance |
|
|
| `GITEA_CLI_REPO` | Repository, like `--repo` |
|
|
|
|
`--no-input` makes a command fail instead of prompting, and `--yes` confirms changes in
|
|
advance.
|
|
|
|
## Gitea Actions
|
|
|
|
Gitea does not allow secret names that start with `GITEA_`, so store the token as, for
|
|
example, `GT_TOKEN`:
|
|
|
|
```yaml
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
staging:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GT_TOKEN }}
|
|
GITEA_CLI_HOST: ${{ gitea.server_url }}
|
|
GITEA_CLI_REPO: ${{ gitea.repository }}
|
|
steps:
|
|
- run: curl -fsSL https://gitea.com/gitea/cli/raw/branch/main/scripts/install.sh | sh
|
|
- run: gt workflow run deploy.yml --ref main --field env=staging --no-input
|
|
```
|
|
|
|
`gt run watch` and `gt pr checks --watch` wait for runs and checks and fail when one fails.
|