Compare commits

...

4 commits

3 changed files with 72 additions and 10 deletions

View file

@ -6,11 +6,7 @@ on:
branches: branches:
- dev-v2 - dev-v2
workflow_call: workflow_call:
inputs: workflow_dispatch:
create_release:
description: 'Create a GitHub release (disabled by default for dry-run/PR builds)'
default: false
type: boolean
permissions: permissions:
contents: write contents: write
id-token: write id-token: write
@ -78,7 +74,7 @@ jobs:
create-release: create-release:
needs: build-and-release needs: build-and-release
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: success() && (github.event_name != 'workflow_call' || inputs.create_release == true) if: success() && github.event_name == 'workflow_dispatch'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
@ -96,6 +92,9 @@ jobs:
- name: Reorganize artifacts - name: Reorganize artifacts
run: | run: |
./scripts/distribute.sh reorganize-artifacts ./scripts/distribute.sh reorganize-artifacts
- name: Consolidate release artifacts
run: |
./scripts/distribute.sh consolidate-release
- name: Create or update release - name: Create or update release
uses: softprops/action-gh-release@2bb465e97f322d3cb2a965294d483e0d26a67aa9 # v3.0.1 uses: softprops/action-gh-release@2bb465e97f322d3cb2a965294d483e0d26a67aa9 # v3.0.1
with: with:
@ -103,10 +102,7 @@ jobs:
name: "${{ steps.version.outputs.version }}" name: "${{ steps.version.outputs.version }}"
generate_release_notes: true generate_release_notes: true
files: | files: |
distribute/x64/* distribute/release/*
distribute/arm64/*
distribute/arm/*
distribute/x86/*
draft: false draft: false
prerelease: true prerelease: true
env: env:

View file

@ -6,6 +6,9 @@
This action allows caching of Advanced Package Tool (APT) package dependencies to improve workflow execution time instead of installing the packages on every run. This action allows caching of Advanced Package Tool (APT) package dependencies to improve workflow execution time instead of installing the packages on every run.
> [!IMPORTANT]
> Version 1 will be in maintenance mode. Due to recently instability in the releases and to create consistent reliability, I am going to lock v1. Version 2 beta will be coming soon to have better testing, and less reliability on Bash script where it has triggered more than one major break.
> [!IMPORTANT] > [!IMPORTANT]
> Looking for co-maintainers to help review changes, and investigate issues. I haven't had as much time to stay on top of this action as I would like to and want to make sure it is still responsive and reliable for the community. If you are interested, please reach out. > Looking for co-maintainers to help review changes, and investigate issues. I haven't had as much time to stay on top of this action as I would like to and want to make sure it is still responsive and reliable for the community. If you are interested, please reach out.

View file

@ -164,6 +164,68 @@ case "${COMMAND}" in
echo "Artifact reorganization complete" 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 "Error: Unknown command: ${COMMAND}" >&2
echo "Usage: distribute.sh <command> [args...]" >&2 echo "Usage: distribute.sh <command> [args...]" >&2
@ -175,6 +237,7 @@ case "${COMMAND}" in
echo " generate-checksums <arch>" >&2 echo " generate-checksums <arch>" >&2
echo " verify-build <arch>" >&2 echo " verify-build <arch>" >&2
echo " reorganize-artifacts" >&2 echo " reorganize-artifacts" >&2
echo " consolidate-release" >&2
exit 1 exit 1
;; ;;