mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2026-05-08 02:53:28 +00:00
Fix cwd
This commit is contained in:
parent
6efb317ada
commit
4e243dc75b
|
|
@ -27,7 +27,10 @@
|
||||||
|
|
||||||
set -eEuo pipefail
|
set -eEuo pipefail
|
||||||
|
|
||||||
source "$(git rev-parse --show-toplevel)/scripts/lib.sh"
|
ROOT_DIR="$(git rev-parse --show-toplevel)"
|
||||||
|
cd "${ROOT_DIR}"
|
||||||
|
|
||||||
|
source "${ROOT_DIR}/scripts/lib.sh"
|
||||||
|
|
||||||
log_info "Using shared library functions for enhanced logging and utilities."
|
log_info "Using shared library functions for enhanced logging and utilities."
|
||||||
|
|
||||||
|
|
@ -79,10 +82,10 @@ function build_binary() {
|
||||||
|
|
||||||
local build_flags="-ldflags=-s -w -X main.version=${version} -X main.commit=${full_sha}"
|
local build_flags="-ldflags=-s -w -X main.version=${version} -X main.commit=${full_sha}"
|
||||||
|
|
||||||
go build "${build_flags}" -o "distribute/${arch}/${binary_name}" ./cmd/cache_apt_pkgs
|
go build "${build_flags}" -o "./distribute/${arch}/${binary_name}" ./cmd/cache_apt_pkgs
|
||||||
|
|
||||||
# Make executable (no-op on Windows but harmless)
|
# Make executable (no-op on Windows but harmless)
|
||||||
chmod +x "distribute/${arch}/${binary_name}"
|
chmod +x "./distribute/${arch}/${binary_name}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generate checksums for binaries
|
# Generate checksums for binaries
|
||||||
|
|
@ -101,10 +104,10 @@ function generate_checksums() {
|
||||||
# Verify build output
|
# Verify build output
|
||||||
function verify_build() {
|
function verify_build() {
|
||||||
local arch="$1"
|
local arch="$1"
|
||||||
ls -la "distribute/${arch}/"
|
ls -la "./distribute/${arch}/"
|
||||||
if [[ -f "distribute/${arch}/cache_apt_pkgs" ]]; then
|
if [[ -f "./distribute/${arch}/cache_apt_pkgs" ]]; then
|
||||||
log_info "Binary built successfully"
|
log_info "Binary built successfully"
|
||||||
file "distribute/${arch}/cache_apt_pkgs"
|
file "./distribute/${arch}/cache_apt_pkgs"
|
||||||
else
|
else
|
||||||
log_error "Binary not found!"
|
log_error "Binary not found!"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -113,18 +116,18 @@ function verify_build() {
|
||||||
|
|
||||||
# Reorganize artifacts
|
# Reorganize artifacts
|
||||||
function reorganize_artifacts() {
|
function reorganize_artifacts() {
|
||||||
mkdir -p distribute
|
mkdir -p ./distribute
|
||||||
for arch_dir in distribute-artifacts/cache-apt-pkgs-*; do
|
for arch_dir in ./distribute-artifacts/cache-apt-pkgs-*; do
|
||||||
if [[ -d ${arch_dir} ]]; then
|
if [[ -d ${arch_dir} ]]; then
|
||||||
local arch_name
|
local arch_name
|
||||||
arch_name=$(basename "${arch_dir}" | sed 's/cache-apt-pkgs-\(.*\)-[a-f0-9]*/\1/')
|
arch_name=$(basename "${arch_dir}" | sed 's/cache-apt-pkgs-\(.*\)-[a-f0-9]*/\1/')
|
||||||
cp -r "${arch_dir}"/* "distribute/${arch_name}/" 2>/dev/null || mkdir -p "distribute/${arch_name}"
|
cp -r "${arch_dir}"/* "./distribute/${arch_name}/" 2>/dev/null || mkdir -p "./distribute/${arch_name}"
|
||||||
cp "${arch_dir}"/* "distribute/${arch_name}/" 2>/dev/null || true
|
cp "${arch_dir}"/* "./distribute/${arch_name}/" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
log_info "Final distribute structure:"
|
log_info "Final distribute structure:"
|
||||||
find distribute -type f -exec ls -la {} \;
|
find ./distribute -type f -exec ls -la {} \;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main script logic
|
# Main script logic
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue