🐛 fix(ci): read DRONE_TAG via awk ENVIRON to fix empty release body

Drone CI substitutes ${VAR} in commands before the shell runs.
Since TAG is a local shell variable (not a Drone var), ${TAG} was
replaced with an empty string, causing the awk pattern to match
nothing and the release body to be empty.

Fix: read DRONE_TAG directly inside awk via ENVIRON["DRONE_TAG"]
and strip the v-prefix with gsub — no intermediate shell variable needed.

Also translate CHANGELOG.md to English.
This commit is contained in:
Cinco Euzebio 2026-03-01 00:19:10 -03:00
parent 3c78a5afe3
commit 055abb7dbe
2 changed files with 23 additions and 14 deletions

View File

@ -76,9 +76,14 @@ steps:
commands: commands:
- apk add --no-cache curl jq - apk add --no-cache curl jq
- | - |
# Extract changelog entry for this tag (strip leading 'v' to match CHANGELOG format) # Read DRONE_TAG via ENVIRON inside awk to avoid Drone's ${VAR} substitution
TAG="${DRONE_TAG#v}" # which would replace ${TAG} with an empty string before the shell runs.
BODY=$(awk "/^## \[${TAG}\]/{found=1; next} found && /^## \[/{exit} found{print}" CHANGELOG.md) BODY=$(awk '
BEGIN { tag = ENVIRON["DRONE_TAG"]; gsub(/^v/, "", tag) }
/^## \[/ { in_section = (index($0, "[" tag "]") > 0); next }
in_section && /^## \[/ { exit }
in_section { print }
' CHANGELOG.md)
RELEASE_ID=$(curl -fsSL -X POST \ RELEASE_ID=$(curl -fsSL -X POST \
-H "Authorization: token $GITEA_TOKEN" \ -H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \

View File

@ -7,29 +7,33 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [0.3.0] - 2026-03-01 ## [0.3.0] - 2026-03-01
### Added ### Added
- Verificação de dependências (`fzf` e `tmux`) ao iniciar, antes de qualquer operação - Dependency check for `fzf` and `tmux` at startup, before any operation
- Detecção automática do gerenciador de pacotes da distro (apt, pacman, dnf, yum, zypper, emerge, xbps, apk) - Automatic Linux package manager detection (apt, pacman, dnf, yum, zypper, emerge, xbps, apk)
- Oferta interativa de instalação caso as ferramentas estejam ausentes - Interactive installation prompt when required tools are missing
- Módulo `deps` com trait `BinaryChecker` injetável para testes unitários sem tocar no sistema real - `deps` module with injectable `BinaryChecker` trait for unit testing without hitting the real system
- Testes de integração em `tests/deps.rs` (11 testes com `SystemBinaryChecker` real) - Integration tests in `tests/deps.rs` (11 tests using real `SystemBinaryChecker`)
- Suite de testes em container Docker Ubuntu 24.04 (`tests/docker/`) com 15 cenários simulando novo usuário - Docker test suite in `tests/docker/` with 15 scenarios simulating a fresh Ubuntu 24.04 user
### Fixed
- Release pipeline `publish` step now reads `DRONE_TAG` via awk `ENVIRON` to prevent Drone's
`${VAR}` substitution from wiping local shell variables before the shell runs
## [0.2.4] - 2026-03-01 ## [0.2.4] - 2026-03-01
### Fixed ### Fixed
- Cálculo do percentual de cobertura no CI (campo correto do JSON do tarpaulin) - Coverage percentage calculation in CI (correct field from tarpaulin JSON output)
- Pipeline `release` restrito a tags com formato de versão (`[0-9]*`) - Release pipeline trigger now matches `v*` tag format instead of `[0-9]*`
## [0.2.2] - 2026-02-28 ## [0.2.2] - 2026-02-28
### Added ### Added
- Coverage badge gerado por `cargo-tarpaulin` no CI e hospedado no Gitea Generic Package Registry - Coverage badge generated by `cargo-tarpaulin` in CI, hosted in Gitea Generic Package Registry
- CI status, coverage, version e Rust edition badges no README - CI status, coverage, version, and Rust edition badges in README
## [0.2.1] - 2026-02-28 ## [0.2.1] - 2026-02-28
### Added ### Added
- Drone CI pipeline (`ci`) that runs `cargo fmt --check`, `cargo clippy`, and `cargo test` on every push and pull request - Drone CI pipeline (`ci`) running `cargo fmt --check`, `cargo clippy`, and `cargo test` on every push and pull request
## [0.2.0] - 2026-02-28 ## [0.2.0] - 2026-02-28