10 Commits
Author SHA256 Message Date
bircni 65b30a62e3 fix: publish nightly builds where dl.gitea.com does not cache them for a year (#102)
`gt upgrade --nightly` and the install scripts' nightly option could fail with a checksum mismatch, or silently install an old build. dl.gitea.com serves `gitea-cli/main/` like a released version, with `cache-control: public, max-age=31536000, immutable`, but each nightly overwrites those files, and each file then leaves the cache on its own. `gitea-cli-main-linux-amd64.xz` was still a build from Nov 2 while its `.sha256` was from Nov 5.

Directories with `nightly` in their name, such as `gitea/main-nightly` and `gitea-runner/nightly`, get `max-age=300, must-revalidate`, so nightlies now go to `gitea-cli/main-nightly`, named like Gitea's.

The v1.0.0 and v1.1.0 binaries still look in `main`, so their `gt upgrade --nightly` stays on the last build there until they upgrade to a release with this change. The CDN's rule isn't in this repository: the headers of the first nightly after this merge will confirm it applies.

Reviewed-on: https://gitea.com/gitea/cli/pulls/102
Reviewed-by: techknowlogick <[email protected]>
2026-11-06 19:31:31 +00:00
silverwind 1f35c36fdc ci: run the Windows tests on every pull request (#79)
Runs the Windows tests on `ubuntu-latest-kvm` as a PR job, with the installed Windows cached, minutes instead of over an hour. Aligned with https://gitea.com/gitea/runner/pulls/1369 and https://gitea.com/gitea/gitea-mcp/pulls/321.

Reviewed-on: https://gitea.com/gitea/cli/pulls/79
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: silverwind <[email protected]>
2026-11-03 13:05:20 +00:00
bircni 8ab446bb4a ci: run the unit tests on Windows (#64)
gt ships Windows builds, but CI only runs the tests on Linux; Windows is only vetted.

gitea.com has no Windows runners, so a new weekly and on-demand workflow installs Windows Server 2025 Core in a [dockur/windows](https://github.com/dockur/windows) QEMU VM and runs the cross-compiled unit test binaries there, the way https://gitea.com/gitea/runner/pulls/1348 does for the runner. Without `/dev/kvm` on the hosts, Windows is emulated and a run takes about two hours.

The first runs also found Windows bugs, fixed here: replacing a settings or credential file that another reader holds open failed, and `gt upgrade` left the old executable behind.

Reviewed-on: https://gitea.com/gitea/cli/pulls/64
2026-11-02 17:29:13 +00:00
bircni 9a26b272ae build: publish OpenBSD builds and install them with install.sh (#32)
gt builds for OpenBSD on amd64 and arm64 unchanged, but releases did not include them. Releases now ship both, and install.sh falls back to the ftp and sha256 tools of base OpenBSD, which has neither curl nor wget. CI vets every release system so a break outside Linux shows up in pull requests.

Refs https://gitea.com/gitea/tea/issues/436

Reviewed-on: https://gitea.com/gitea/cli/pulls/32
2026-10-26 17:59:51 +00:00
bircni 7c056bb609 fix: fix bugs across requests, PRs, issues, Actions and terminal (#7)
Fixes the problems found in repeated reviews and end-to-end runs against Gitea 28.2 before tagging v0.1.0. Each fix comes with a regression test.

- Requests: http_timeout only bounds waiting (uploads and slow downloads aren't cut off, stalls fail), safe retries, redirects to object storage, secrets kept out of `--debug`/`--verbose`, `--paginate` without Link headers
- Pull requests: fork pushes, review comments on the exact diff line, pending reviews, `pr edit` reports what Gitea leaves out
- Issues and more: metadata Gitea drops is reported, missing repository vs. missing item named, deadlines as end of day
- Actions and releases: watch loops survive short outages, exact asset names
- Terminal: color settings, escape sanitizing, accessible forms (TERM=dumb), Windows console
- Build: Go 1.27.3, Docker entrypoint, install script, Makefile

Reviewed-on: https://gitea.com/gitea/cli/pulls/7
2026-10-21 18:29:16 +00:00
bircni 778474c8cc feat: Add install scripts for Linux, macOS, FreeBSD and Windows (#3)
Adds install scripts that download the `gt` binary for the system from dl.gitea.com, verify its SHA-256 checksum and install it.

Linux, macOS and FreeBSD, into `/usr/local/bin` or `~/.local/bin`:

```sh
curl -fsSL https://gitea.com/gitea/cli/raw/branch/main/scripts/install.sh | sh
# the latest nightly build
curl -fsSL https://gitea.com/gitea/cli/raw/branch/main/scripts/install.sh | sh -s -- --nightly
```

Windows, into `%LOCALAPPDATA%\Programs\gitea-cli`, which is added to the user's PATH:

```powershell
irm https://gitea.com/gitea/cli/raw/branch/main/scripts/install.ps1 | iex
# the latest nightly build
$env:GITEA_CLI_VERSION = "nightly"; irm https://gitea.com/gitea/cli/raw/branch/main/scripts/install.ps1 | iex
```

`GITEA_CLI_VERSION` (a version such as `1.0.0`, or `nightly` for the latest build of the main branch), `GITEA_CLI_INSTALL_DIR` and `GITEA_CLI_DOWNLOAD_URL` choose another version, directory or mirror; `install.sh` also takes `--version VERSION`. Without a version, the latest gitea/cli release is installed.

Fixes gitea/tea#642.

Reviewed-on: https://gitea.com/gitea/cli/pulls/3
2026-10-19 06:11:01 +00:00
bircni 4a35b1577d enhance!: rename tea to gt
The CLI becomes gitea-cli, invoked as gt.

- module path gitea.dev/cli, repository gitea.com/gitea/cli
- the binary, completions and man pages are named gt
- environment variables use the GITEA_CLI_ prefix
- the configuration directory, keyring service and git config keys use
  gitea-cli
- release archives, the Docker image and the snap are named gitea-cli
- version builds only from v* tags
- remove the 1.0 migration guide

Signed-off-by: bircni <[email protected]>
2026-10-18 22:57:54 +02:00
bircni 87f62de69b feat!: rebuild tea on Cobra with explicit noun/verb commands (#1126)
- **switch tea to the Cobra command tree:** `internal/app` wires the packages from parts 1–4 into explicit noun/verb commands with `--repo`, `--json` / `--jq`, `--sudo` and `--debug`; `main.go` points at it. Build, release and docs tooling (`tools/cli-docs`, Makefile, goreleaser, snap, CI) and README / CONTRIBUTING are updated.
- **remove the urfave/cli command tree:** deletes `cmd/`, `modules/`, the old integration tests, contrib completion scripts and the generated `docs/CLI.md`, and drops their dependencies. This commit only deletes.

## Breaking changes

This is a breaking release. It requires Gitea 28 or newer; configuration moves to separate `config.yml` and `hosts.yml` files and requires fresh authentication, and command names, aliases, flags and output formats change. `docs/migration-1.0.md` maps every old command, flag and environment variable to its replacement.

## Issues

fixes #1118
fixes #1116
fixes #1115
fixes #1094
fixes #1091
fixes #1073
fixes #1052
fixes #1032
fixes #1023
fixes #966
fixes #908
fixes #833
fixes #831
fixes #817
fixes #804
fixes #779
fixes #770
fixes #737
fixes #697
fixes #726
fixes #677
fixes #672
fixes #633
fixes #632
fixes #560
fixes #556
fixes #523
fixes #516
fixes #510
fixes #504
fixes #500
fixes #482
fixes #406
fixes #403
fixes #373
fixes #351
fixes #344
fixes #326
fixes #325
fixes #323
fixes #246
fixes #240
fixes #232
fixes #197
fixes #172
fixes #141
fixes #69
fixes #1110
fixes #569
fixes #480
fixes #666
fixes #670
fixes #457
fixes #643
fixes #498
fixes #490
fixes #1069
fixes #834
fixes #602
fixes #328
fixes #417
fixes #571
fixes #1029
fixes #489
fixes #1050
fixes #162
fixes #430
fixes #1087
fixes #683

Reviewed-on: https://gitea.com/gitea/tea/pulls/1126
Reviewed-by: TheFox0x7 <[email protected]>
2026-10-11 17:23:06 +00:00
Lunny Xiao a046cabd14 ci: Drop AWS S3 release upload, keep only Cloudflare R2 (#1092)
The release pipeline uploaded artifacts to both AWS S3 (goreleaser `blobs:`) and Cloudflare R2 (custom publisher) during the migration period. The migration is done, so this removes the S3 half:

- drop the `blobs:` block from `.goreleaser.yaml`
- drop the `AWS_*` / `S3_*` env from the nightly and tag release workflows
- update the comments in `.goreleaser.yaml` and `scripts/upload-r2.sh` accordingly

Cloudflare R2 upload (including the early `--check-config` preflight step) is unchanged, and the `AWS_*` repo secrets are no longer used.

Reviewed-on: https://gitea.com/gitea/tea/pulls/1092
Reviewed-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
2026-08-15 20:17:51 +00:00
Lunny Xiao d2cfd3438a ci(goreleaser): mirror release artifacts to Cloudflare R2 (#1063)
Ports the Cloudflare R2 release mirror from [gitea.com/gitea/runner](https://gitea.com/gitea/runner) to `tea`, so release artifacts land in R2 alongside S3 for the duration of the migration away from S3.

Two commits, meant to be reviewed in order.

## 1. `ci(goreleaser): migrate release config to goreleaser v2`

A purely mechanical migration, no behaviour change intended:

- add `version: 2`
- `blobs.folder` -> `blobs.directory`
- `snapshot.name_template` -> `snapshot.version_template`
- `nightly.name_template` -> `nightly.version_template`
- `version: "~> v1"` -> `"~> v2"` in both release workflows

This is a prefactor rather than scope creep. Under goreleaser v1 the custom-publisher pipe runs *4th*, before the `release` pipe; under v2 it runs *last*. That ordering difference matters for the change below: on v1 a failed R2 upload would abort the publish after every artifact had already gone to S3 but **before** the Gitea release was created, leaving a half-finished release. On v2 the R2 mirror runs after the release exists, which matches the behaviour the runner repo already has in production.

The pre-existing `archives.format` deprecation warning is deliberately left alone; it is orthogonal to this change and the runner repo has not addressed it either.

## 2. `ci(goreleaser): mirror release artifacts to Cloudflare R2`

- **`scripts/upload-r2.sh`** — uploads one local file to one R2 object key using curl's built-in AWS SigV4 signer (R2 is S3-API compatible). Credentials are fed through `curl --config -` so they never appear in `ps` output. Also provides a `--check-config` preflight mode. This file is byte-identical to the runner repo's copy.
- **`.goreleaser.yaml`** — a `publishers:` entry mirroring the existing S3 `blobs:` upload into R2. A second `blobs:` entry is not usable here: the blob pipe authenticates from the global `AWS_*` environment and has no per-entry credentials, whereas `publishers:` supports per-entry `env:`.
- **Both release workflows** — forward the R2 secrets, plus an early `check R2 configuration` step. Custom publishers run as the very last step of goreleaser's publish pipeline, so without a preflight a missing secret would only surface after the release had been created and every artifact already uploaded to S3.

### Deviation from the runner implementation

The publisher here also sets `signature: true` in addition to `checksum: true`. `tea` has a `signs:` block that GPG-signs the checksum file, and the S3 blob pipe uploads the resulting `checksums.txt.sig`; without `signature: true` the R2 mirror would carry the artifacts and their checksums but no signature to verify them against.

The object key prefix is `tea/{{ .Version }}/...`, matching the existing S3 `directory: "tea/{{.Version}}"`.

## Required repository secrets

This PR is inert until these are configured. The preflight step will fail the release loudly if they are missing:

- `R2_ENDPOINT` — e.g. `https://<account>.r2.cloudflarestorage.com`
- `R2_BUCKET`
- `R2_ACCESS_KEY_ID`
- `R2_SECRET_ACCESS_KEY`

## Verification

- `goreleaser check` against the migrated config (with the pro-only `nightly:` block temporarily stripped, since the check ran with the OSS v2 binary): *configuration is valid*, the only deprecation being the pre-existing `archives.format`.
- A real `goreleaser build --snapshot --clean --single-target` against the v2 config: succeeded, including the `xz` and `.goreleaser.checksum.sh` post-hooks.
- `scripts/upload-r2.sh`: clean under `sh -n` and `shellcheck`; all four `--check-config` cases exercised (all vars unset, one missing, all set, wrong argument count).
- The actual upload path was not exercised end to end, since that needs live R2 credentials.

Reviewed-on: https://gitea.com/gitea/tea/pulls/1063
Reviewed-by: Zettat123 <[email protected]>
2026-07-26 03:21:03 +00:00