From d77d17a7ea63bd575d6f67f0fc719e35c5fc6896 Mon Sep 17 00:00:00 2001 From: cinco euzebio Date: Sun, 1 Mar 2026 00:19:10 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(ci):=20read=20DRONE=5FTAG=20?= =?UTF-8?q?via=20awk=20ENVIRON=20to=20fix=20empty=20release=20body?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .drone.yml | 11 ++++++++--- CHANGELOG.md | 26 +++++++++++++++----------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/.drone.yml b/.drone.yml index 6bb554d..be0ae1a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -76,9 +76,14 @@ steps: commands: - apk add --no-cache curl jq - | - # Extract changelog entry for this tag (strip leading 'v' to match CHANGELOG format) - TAG="${DRONE_TAG#v}" - BODY=$(awk "/^## \[${TAG}\]/{found=1; next} found && /^## \[/{exit} found{print}" CHANGELOG.md) + # Read DRONE_TAG via ENVIRON inside awk to avoid Drone's ${VAR} substitution + # which would replace ${TAG} with an empty string before the shell runs. + 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 \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ diff --git a/CHANGELOG.md b/CHANGELOG.md index f545ed1..dd433af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 ### Added -- Verificação de dependências (`fzf` e `tmux`) ao iniciar, antes de qualquer operação -- Detecção automática do gerenciador de pacotes da distro (apt, pacman, dnf, yum, zypper, emerge, xbps, apk) -- Oferta interativa de instalação caso as ferramentas estejam ausentes -- Módulo `deps` com trait `BinaryChecker` injetável para testes unitários sem tocar no sistema real -- Testes de integração em `tests/deps.rs` (11 testes com `SystemBinaryChecker` real) -- Suite de testes em container Docker Ubuntu 24.04 (`tests/docker/`) com 15 cenários simulando novo usuário +- Dependency check for `fzf` and `tmux` at startup, before any operation +- Automatic Linux package manager detection (apt, pacman, dnf, yum, zypper, emerge, xbps, apk) +- Interactive installation prompt when required tools are missing +- `deps` module with injectable `BinaryChecker` trait for unit testing without hitting the real system +- Integration tests in `tests/deps.rs` (11 tests using real `SystemBinaryChecker`) +- 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 ### Fixed -- Cálculo do percentual de cobertura no CI (campo correto do JSON do tarpaulin) -- Pipeline `release` restrito a tags com formato de versão (`[0-9]*`) +- Coverage percentage calculation in CI (correct field from tarpaulin JSON output) +- Release pipeline trigger now matches `v*` tag format instead of `[0-9]*` ## [0.2.2] - 2026-02-28 ### Added -- Coverage badge gerado por `cargo-tarpaulin` no CI e hospedado no Gitea Generic Package Registry -- CI status, coverage, version e Rust edition badges no README +- Coverage badge generated by `cargo-tarpaulin` in CI, hosted in Gitea Generic Package Registry +- CI status, coverage, version, and Rust edition badges in README ## [0.2.1] - 2026-02-28 ### 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