4465459b69
- scripts/release/prepare-release.sh bumps workspace + crate pins + npm wrapper + README install tags, refreshes Cargo.lock, regenerates the TUI changelog slice and web facts, then runs check-versions.sh - check-versions.sh now also gates web/lib/facts.generated.ts and the README install-tag examples (both drifted silently before) - .cnb.yml validates the pushed tag against Cargo.toml before generating mirror release notes - RELEASE_CHECKLIST/RUNBOOK updated accordingly (v0.8.56 needed 9 fix commits for exactly these sync points)
184 lines
5.7 KiB
YAML
184 lines
5.7 KiB
YAML
# CNB is a one-way mirror from GitHub. Keep this file source-controlled here;
|
|
# CNB-side edits will be overwritten by the GitHub -> CNB sync workflow.
|
|
|
|
.feishu_bridge_tests: &feishu_bridge_tests
|
|
name: feishu bridge tests
|
|
runner:
|
|
tags: cnb:arch:amd64
|
|
cpus: 8
|
|
docker:
|
|
image: node:22-bookworm
|
|
stages:
|
|
- name: feishu bridge tests
|
|
script: |
|
|
set -eu
|
|
cd integrations/feishu-bridge
|
|
npm ci
|
|
npm run check
|
|
npm test
|
|
|
|
.linux_rust_gates: &linux_rust_gates
|
|
name: linux rust gates
|
|
runner:
|
|
tags: cnb:arch:amd64
|
|
cpus: 16
|
|
docker:
|
|
image: rust:1.88-bookworm
|
|
stages:
|
|
- name: install linux dependencies
|
|
script: |
|
|
set -eu
|
|
apt-get update
|
|
apt-get install -y git libdbus-1-dev nodejs npm pkg-config
|
|
if command -v rustup >/dev/null 2>&1; then
|
|
rustup component add rustfmt clippy
|
|
fi
|
|
|
|
- name: rust workspace gates
|
|
script: |
|
|
set -eu
|
|
./scripts/release/check-versions.sh
|
|
./scripts/release/check-ohos-deps.sh
|
|
cargo fmt --all -- --check
|
|
cargo check --workspace --all-targets --locked
|
|
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
|
|
cargo test --workspace --all-features --locked
|
|
|
|
- name: linux npm wrapper smoke
|
|
script: |
|
|
set -eu
|
|
cargo build --release --locked -p codewhale-cli -p codewhale-tui
|
|
export PATH="$PWD/target/release:$PATH"
|
|
node scripts/release/npm-wrapper-smoke.js
|
|
./target/release/codewhale --version
|
|
./target/release/codewhale-tui --version
|
|
|
|
.linux_release_preflight: &linux_release_preflight
|
|
name: linux release preflight
|
|
runner:
|
|
tags: cnb:arch:amd64
|
|
cpus: 16
|
|
docker:
|
|
image: rust:1.88-bookworm
|
|
stages:
|
|
- name: install release dependencies
|
|
script: |
|
|
set -eu
|
|
apt-get update
|
|
apt-get install -y curl git libdbus-1-dev nodejs npm pkg-config
|
|
if command -v rustup >/dev/null 2>&1; then
|
|
rustup component add rustfmt clippy
|
|
fi
|
|
|
|
- name: rust workspace gates
|
|
script: |
|
|
set -eu
|
|
./scripts/release/check-versions.sh
|
|
./scripts/release/check-ohos-deps.sh
|
|
cargo fmt --all -- --check
|
|
cargo check --workspace --all-targets --locked
|
|
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
|
|
cargo test --workspace --all-features --locked
|
|
|
|
- name: crate publish dry-run
|
|
script: |
|
|
set -eu
|
|
./scripts/release/publish-crates.sh dry-run
|
|
|
|
- name: release binary smoke
|
|
script: |
|
|
set -eu
|
|
cargo build --release --locked -p codewhale-cli -p codewhale-tui
|
|
export PATH="$PWD/target/release:$PATH"
|
|
node scripts/release/npm-wrapper-smoke.js
|
|
./target/release/codewhale --version
|
|
./target/release/codewhale-tui --version
|
|
|
|
main:
|
|
push:
|
|
- *feishu_bridge_tests
|
|
- *linux_rust_gates
|
|
|
|
"(fix/*|rebrand/*)":
|
|
push:
|
|
- *linux_rust_gates
|
|
|
|
"work/v*":
|
|
push:
|
|
- *feishu_bridge_tests
|
|
- *linux_release_preflight
|
|
|
|
$:
|
|
tag_push:
|
|
- docker:
|
|
image: rust:1.88-bookworm
|
|
stages:
|
|
- name: build linux x64 release assets
|
|
script: |
|
|
set -eu
|
|
|
|
apt-get update
|
|
apt-get install -y git libdbus-1-dev nodejs pkg-config
|
|
|
|
./scripts/release/check-versions.sh
|
|
./scripts/release/check-ohos-deps.sh
|
|
cargo build --release --locked -p codewhale-cli -p codewhale-tui
|
|
|
|
mkdir -p target/cnb-release
|
|
cp target/release/codewhale target/cnb-release/codewhale-linux-x64
|
|
cp target/release/codewhale-tui target/cnb-release/codewhale-tui-linux-x64
|
|
strip \
|
|
target/cnb-release/codewhale-linux-x64 \
|
|
target/cnb-release/codewhale-tui-linux-x64 \
|
|
|| true
|
|
|
|
(
|
|
cd target/cnb-release
|
|
sha256sum \
|
|
codewhale-linux-x64 \
|
|
codewhale-tui-linux-x64 \
|
|
> codewhale-artifacts-sha256.txt
|
|
)
|
|
|
|
tag_name="${CNB_BRANCH:-}"
|
|
if [ -z "$tag_name" ]; then
|
|
tag_name="$(git describe --tags --exact-match 2>/dev/null || true)"
|
|
fi
|
|
version="${tag_name#v}"
|
|
cargo_version="$(grep -E '^version = "' Cargo.toml | head -n1 | sed -E 's/^version = "([^"]+)".*/\1/')"
|
|
if [ -n "$tag_name" ] && [ "$version" != "$cargo_version" ]; then
|
|
echo "ERROR: tag ${tag_name} does not match Cargo.toml version ${cargo_version}" >&2
|
|
exit 1
|
|
fi
|
|
commit_sha="${CNB_COMMIT:-$(git rev-parse HEAD)}"
|
|
{
|
|
echo "# ${tag_name:-CNB release}"
|
|
echo
|
|
awk -v version="${version}" '
|
|
index($0, "## [" version "]") == 1 { in_section = 1; next }
|
|
in_section && /^## \[/ { exit }
|
|
in_section { print }
|
|
' CHANGELOG.md
|
|
echo
|
|
echo "Built by CNB from ${commit_sha}."
|
|
echo
|
|
echo "Assets:"
|
|
echo "- codewhale-linux-x64"
|
|
echo "- codewhale-tui-linux-x64"
|
|
echo "- codewhale-artifacts-sha256.txt"
|
|
} > target/cnb-release/CNB_RELEASE.md
|
|
|
|
- name: create cnb release
|
|
type: git:release
|
|
options:
|
|
descriptionFromFile: target/cnb-release/CNB_RELEASE.md
|
|
latest: true
|
|
|
|
- name: upload linux x64 release assets
|
|
image: cnbcool/attachments:latest
|
|
settings:
|
|
attachments:
|
|
- target/cnb-release/codewhale-linux-x64
|
|
- target/cnb-release/codewhale-tui-linux-x64
|
|
- target/cnb-release/codewhale-artifacts-sha256.txt
|