fix: add python3 to dependencies and improve package name extraction logic
This commit is contained in:
@@ -14,7 +14,7 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
build-essential git ca-certificates curl tar gzip
|
||||
build-essential git ca-certificates curl tar gzip python3
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -62,19 +62,10 @@ jobs:
|
||||
run: |
|
||||
set -e
|
||||
if [ -f Cargo.toml ]; then
|
||||
PKG_NAME="$(cargo metadata --no-deps --format-version=1 | python3 - <<'PY'
|
||||
import json
|
||||
import sys
|
||||
|
||||
data = json.load(sys.stdin)
|
||||
for pkg in data.get("packages", []):
|
||||
for target in pkg.get("targets", []):
|
||||
if "bin" in target.get("kind", []):
|
||||
print(target.get("name", ""))
|
||||
raise SystemExit(0)
|
||||
print("")
|
||||
PY
|
||||
)"
|
||||
PKG_NAME="$(cargo metadata --no-deps --format-version=1 2>/dev/null | python3 -c 'import json,sys; data=json.load(sys.stdin); names=[t.get("name","") for p in data.get("packages", []) for t in p.get("targets", []) if "bin" in t.get("kind", [])]; print(names[0] if names else "")')"
|
||||
if [ -z "${PKG_NAME:-}" ]; then
|
||||
PKG_NAME="$(sed -n 's/^name = \"\\(.*\\)\"/\\1/p' Cargo.toml | head -n 1)"
|
||||
fi
|
||||
fi
|
||||
if [ -z "${PKG_NAME:-}" ]; then
|
||||
FULL="${GITHUB_REPOSITORY:-}"
|
||||
|
||||
Reference in New Issue
Block a user