refactor: enhance build workflow with debugging and caching steps

This commit is contained in:
2026-01-11 07:59:39 +01:00
parent d47e73f47b
commit 840cf0ba99

View File

@@ -20,15 +20,40 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Debug workspace
shell: bash
run: |
set -e
pwd
ls -la
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Read package name
id: pkg_meta
shell: bash
run: |
set -e
PKG_NAME="$(sed -n 's/^name = \"\\(.*\\)\"/\\1/p' Cargo.toml | head -n 1)"
if [ -z "$PKG_NAME" ]; then
echo "Could not read package name from Cargo.toml"
exit 1
if [ -f Cargo.toml ]; then
PKG_NAME="$(sed -n 's/^name = \"\\(.*\\)\"/\\1/p' Cargo.toml | head -n 1)"
fi
if [ -z "${PKG_NAME:-}" ]; then
FULL="${GITHUB_REPOSITORY:-}"
if [ -z "$FULL" ]; then
echo "Could not read Cargo.toml and GITHUB_REPOSITORY is empty"
exit 1
fi
PKG_NAME="${FULL##*/}"
echo "Cargo.toml missing or unreadable. Falling back to repo name: $PKG_NAME"
fi
echo "pkg_name=$PKG_NAME" >> "$GITHUB_OUTPUT"