refactor: enhance build workflow with debugging and caching steps
This commit is contained in:
@@ -20,16 +20,41 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
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
|
- name: Read package name
|
||||||
id: pkg_meta
|
id: pkg_meta
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
|
if [ -f Cargo.toml ]; then
|
||||||
PKG_NAME="$(sed -n 's/^name = \"\\(.*\\)\"/\\1/p' Cargo.toml | head -n 1)"
|
PKG_NAME="$(sed -n 's/^name = \"\\(.*\\)\"/\\1/p' Cargo.toml | head -n 1)"
|
||||||
if [ -z "$PKG_NAME" ]; then
|
fi
|
||||||
echo "Could not read package name from Cargo.toml"
|
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
|
exit 1
|
||||||
fi
|
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"
|
echo "pkg_name=$PKG_NAME" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Create source tarball (code)
|
- name: Create source tarball (code)
|
||||||
|
|||||||
Reference in New Issue
Block a user