Skip to content

Commit adca7a8

Browse files
committed
feat(ci): yq+perl -> dasel, check version format
Signed-off-by: Jan Pokorný <[email protected]>
1 parent 3493baa commit adca7a8

File tree

3 files changed

+35
-25
lines changed

3 files changed

+35
-25
lines changed

apps/beeai-cli/tasks.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ run = "uv run beeai"
5757
dir = "{{config_root}}/apps/beeai-cli"
5858
run = '''
5959
set -e
60-
LIMA_VERSION=$(yq -r '.tools["asdf:CrouchingMuppet/asdf-lima"]' ../../mise.toml)
60+
LIMA_VERSION=$(dasel -f ../../mise.toml -w plain '.tools.property(asdf:CrouchingMuppet/asdf-lima)')
6161
mkdir -p ./vendor
6262
echo '*' >./vendor/.gitignore
6363
( test -f ./vendor/lima-$LIMA_VERSION/manylinux_2_28_x86_64/bin/limactl || ( mkdir -p ./vendor/lima-$LIMA_VERSION/manylinux_2_28_x86_64 && curl -fsL -H "Authorization: Bearer $GITHUB_TOKEN" https://github.com/lima-vm/lima/releases/download/v${LIMA_VERSION}/lima-${LIMA_VERSION}-Linux-x86_64.tar.gz | tar -xzf - -C ./vendor/lima-$LIMA_VERSION/manylinux_2_28_x86_64 )) &
@@ -86,8 +86,8 @@ set -euo pipefail
8686
rm -rf ./dist
8787
uv build -q --out-dir ./dist
8888
89-
export lima_version=$(yq -r '.tools["asdf:CrouchingMuppet/asdf-lima"]' ../../mise.toml)
90-
export version="$(yq -o toml .project.version pyproject.toml | tr -d -)"
89+
export lima_version=$(dasel -w plain -f ../../mise.toml '.tools.property(asdf:CrouchingMuppet/asdf-lima)')
90+
export version="$(dasel -w plain -f pyproject.toml '.project.version' | tr -d -)"
9191
export universal_wheel=$(realpath "./dist/beeai_cli-$version-py3-none-any.whl")
9292
9393
build_wheel() {

mise.lock

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
version = "1.1.1"
33
backend = "asdf:CrouchingMuppet/asdf-lima"
44

5+
[tools.dasel]
6+
version = "2.8.1"
7+
backend = "aqua:TomWright/dasel"
8+
9+
[tools.dasel.checksums]
10+
dasel_darwin_amd64 = "sha256:be3cc4bcc2272873a071db5dcbfee2a81ad73cba3750476ee91f3fd554fb5d76"
11+
512
[tools.fd]
613
version = "10.2.0"
714
backend = "aqua:sharkdp/fd"
@@ -68,11 +75,3 @@ backend = "aqua:astral-sh/uv"
6875

6976
[tools.uv.checksums]
7077
"uv-aarch64-apple-darwin.tar.gz" = "sha256:698d24883fd441960fb4bc153b7030b89517a295502017ff3fdbba2fb0a0aa67"
71-
72-
[tools.yq]
73-
version = "4.45.4"
74-
backend = "aqua:mikefarah/yq"
75-
76-
[tools.yq.checksums]
77-
yq_darwin_amd64 = "sha256:5580ff2c1fc80dd91f248b3e19af2431f1c95767ad0949a60176601ca5140318"
78-
yq_darwin_arm64 = "sha256:602dbbc116af9eb8a91d2239d0ec286eb9c90b94e76676d5268ab6ca184719b6"

mise.toml

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ kubeconform = "latest"
1616
"ubi:telepresenceio/telepresence" = "latest"
1717

1818
# Misc
19-
yq = "latest"
19+
dasel = "latest"
2020
fd = "latest"
2121
"ubi:google/addlicense" = "latest"
2222

@@ -99,12 +99,12 @@ run = """
9999
#!/bin/bash
100100
set -e -o pipefail
101101
102-
helm_version=$(yq -r .version helm/Chart.yaml)
103-
helm_app_version=$(yq -r .appVersion helm/Chart.yaml)
104-
beeai_cli_version=$(yq -r .project.version apps/beeai-cli/pyproject.toml)
105-
beeai_server_version=$(yq -r .project.version apps/beeai-server/pyproject.toml)
106-
beeai_ui_version=$(yq -r .version apps/beeai-ui/package.json)
107-
beeai_web_version=$(yq -r .version apps/beeai-web/package.json)
102+
helm_version=$(dasel -w plain -f helm/Chart.yaml '.version')
103+
helm_app_version=$(dasel -w plain -f helm/Chart.yaml '.appVersion')
104+
beeai_cli_version=$(dasel -w plain -f apps/beeai-cli/pyproject.toml '.project.version')
105+
beeai_server_version=$(dasel -w plain -f apps/beeai-server/pyproject.toml '.project.version')
106+
beeai_ui_version=$(dasel -w plain -f apps/beeai-ui/package.json '.version')
107+
beeai_web_version=$(dasel -w plain -f apps/beeai-web/package.json '.version')
108108
109109
if [ "$helm_version" != "$helm_app_version" ] || \
110110
[ "$helm_version" != "$beeai_cli_version" ] || \
@@ -147,15 +147,26 @@ if [[ -n "$(git status --porcelain)" ]]; then
147147
exit 1
148148
fi
149149
150-
# Prompt for version bump
151-
read -p "Bump from $(yq -r .version helm/Chart.yaml) to: " new_version
150+
# Prompt for version bump with validation
151+
current_version=$(dasel -f helm/Chart.yaml -r yaml -s '.version')
152+
while true; do
153+
read -p "Bump from ${current_version} to: " new_version
154+
if [[ "$new_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]+)?$ ]]; then
155+
break
156+
else
157+
echo "ERROR: Invalid version format. Use #.#.# or #.#.#-rc#"
158+
fi
159+
done
152160
153161
# Update all version fields
154-
yq -i ".version = \"$new_version\" | .appVersion = \"$new_version\"" helm/Chart.yaml
155-
perl -pi -e "s/^(version\\s*=\\s*\")[^\"]*(\")/\${1}$new_version\${2}/" apps/beeai-cli/pyproject.toml
156-
perl -pi -e "s/^(version\\s*=\\s*\")[^\"]*(\")/\${1}$new_version\${2}/" apps/beeai-server/pyproject.toml
157-
yq -i ".version = \"$new_version\"" apps/beeai-ui/package.json
158-
yq -i ".version = \"$new_version\"" apps/beeai-web/package.json
162+
dasel put -f helm/Chart.yaml -r yaml -t string -v "$new_version" '.version'
163+
dasel put -f helm/Chart.yaml -r yaml -t string -v "$new_version" '.appVersion'
164+
dasel put -f apps/beeai-cli/pyproject.toml -r toml -t string -v "$new_version" '.project.version'
165+
dasel put -f apps/beeai-server/pyproject.toml -r toml -t string -v "$new_version" '.project.version'
166+
dasel put -f apps/beeai-ui/package.json -r json -t string -v "$new_version" '.version'
167+
dasel put -f apps/beeai-web/package.json -r json -t string -v "$new_version" '.version'
168+
169+
# Update lockfile with new version
159170
uv lock
160171
161172
# Confirm commit and push (default: yes)

0 commit comments

Comments
 (0)