mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2026-07-06 09:04:38 +00:00
Merge branch 'master' of https://github.com/awalsh128/cache-apt-pkgs-action
This commit is contained in:
commit
58600a5c77
16
.github/workflows/build-distribute.yml
vendored
16
.github/workflows/build-distribute.yml
vendored
|
|
@ -6,11 +6,7 @@ on:
|
|||
branches:
|
||||
- dev-v2
|
||||
workflow_call:
|
||||
inputs:
|
||||
create_release:
|
||||
description: 'Create a GitHub release (disabled by default for dry-run/PR builds)'
|
||||
default: false
|
||||
type: boolean
|
||||
workflow_dispatch:
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
|
|
@ -78,7 +74,7 @@ jobs:
|
|||
create-release:
|
||||
needs: build-and-release
|
||||
runs-on: ubuntu-latest
|
||||
if: success() && (github.event_name != 'workflow_call' || inputs.create_release == true)
|
||||
if: success() && github.event_name == 'workflow_dispatch'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
|
|
@ -96,6 +92,9 @@ jobs:
|
|||
- name: Reorganize artifacts
|
||||
run: |
|
||||
./scripts/distribute.sh reorganize-artifacts
|
||||
- name: Consolidate release artifacts
|
||||
run: |
|
||||
./scripts/distribute.sh consolidate-release
|
||||
- name: Create or update release
|
||||
uses: softprops/action-gh-release@2bb465e97f322d3cb2a965294d483e0d26a67aa9 # v3.0.1
|
||||
with:
|
||||
|
|
@ -103,10 +102,7 @@ jobs:
|
|||
name: "${{ steps.version.outputs.version }}"
|
||||
generate_release_notes: true
|
||||
files: |
|
||||
distribute/x64/*
|
||||
distribute/arm64/*
|
||||
distribute/arm/*
|
||||
distribute/x86/*
|
||||
distribute/release/*
|
||||
draft: false
|
||||
prerelease: true
|
||||
env:
|
||||
|
|
|
|||
|
|
@ -164,6 +164,68 @@ case "${COMMAND}" in
|
|||
echo "Artifact reorganization complete"
|
||||
;;
|
||||
|
||||
###############################################################################
|
||||
# Consolidate all per-architecture artifacts into a single flat
|
||||
# distribute/release/ directory for upload to GitHub Releases.
|
||||
# Common files (shell scripts, action.yml, apt-fast) are copied once from the
|
||||
# first available architecture directory. Architecture-specific binaries
|
||||
# (apt_query-*) are copied from every architecture directory. A combined
|
||||
# checksums.txt is generated at the end.
|
||||
###############################################################################
|
||||
consolidate-release)
|
||||
RELEASE_DIR="distribute/release"
|
||||
ARCH_DIRS=(distribute/x64 distribute/arm64 distribute/arm distribute/x86)
|
||||
mkdir -p "${RELEASE_DIR}"
|
||||
echo "Consolidating release artifacts into ${RELEASE_DIR}..."
|
||||
|
||||
# Find first available arch directory to source common files from.
|
||||
FIRST_ARCH_DIR=""
|
||||
for arch_dir in "${ARCH_DIRS[@]}"; do
|
||||
if [[ -d "${arch_dir}" ]]; then
|
||||
FIRST_ARCH_DIR="${arch_dir}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z "${FIRST_ARCH_DIR}" ]]; then
|
||||
echo "Error: No architecture directories found under distribute/" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy common files (everything except arch-specific binaries and checksums)
|
||||
# from the first arch directory.
|
||||
shopt -s nullglob
|
||||
for f in "${FIRST_ARCH_DIR}"/*; do
|
||||
filename="$(basename "${f}")"
|
||||
if [[ "${filename}" == apt_query-* ]] || [[ "${filename}" == checksums.txt ]]; then
|
||||
continue
|
||||
fi
|
||||
cp "${f}" "${RELEASE_DIR}/"
|
||||
echo "Copied common file: ${filename}"
|
||||
done
|
||||
shopt -u nullglob
|
||||
|
||||
# Copy architecture-specific binaries from every arch directory.
|
||||
shopt -s nullglob
|
||||
for arch_dir in "${ARCH_DIRS[@]}"; do
|
||||
[[ -d "${arch_dir}" ]] || continue
|
||||
for binary in "${arch_dir}"/apt_query-*; do
|
||||
cp "${binary}" "${RELEASE_DIR}/"
|
||||
echo "Copied binary: $(basename "${binary}")"
|
||||
done
|
||||
done
|
||||
shopt -u nullglob
|
||||
|
||||
# Generate a combined checksums file for all release assets.
|
||||
(cd "${RELEASE_DIR}" && find . -maxdepth 1 -type f ! -name "checksums.txt" \
|
||||
-exec sha256sum {} + | sed 's|\./||' | sort > checksums.txt)
|
||||
echo "Generated combined checksums:"
|
||||
cat "${RELEASE_DIR}/checksums.txt"
|
||||
|
||||
echo "Consolidation complete. Release directory contents:"
|
||||
ls -la "${RELEASE_DIR}/"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Error: Unknown command: ${COMMAND}" >&2
|
||||
echo "Usage: distribute.sh <command> [args...]" >&2
|
||||
|
|
@ -175,6 +237,7 @@ case "${COMMAND}" in
|
|||
echo " generate-checksums <arch>" >&2
|
||||
echo " verify-build <arch>" >&2
|
||||
echo " reorganize-artifacts" >&2
|
||||
echo " consolidate-release" >&2
|
||||
exit 1
|
||||
;;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue