The preflight swallowed the reason mount() failed, so a refused tmpfs mount looked like a generic privilege problem. Print the command's own error and name the two fixes: container.privileged in the act_runner config, or a label registered in host mode.
146 lines
5.9 KiB
YAML
146 lines
5.9 KiB
YAML
name: Release
|
|
|
|
# Publishes a new version line: official build, then the release on Gitea and
|
|
# on GitHub with the ISO attached.
|
|
#
|
|
# Triggered when VERSION changes on Main (any push that touches VERSION fires
|
|
# it, even alongside other files: the path filter is an OR), and manually from
|
|
# the Actions tab.
|
|
on:
|
|
push:
|
|
branches: [Main]
|
|
paths:
|
|
- VERSION
|
|
workflow_dispatch:
|
|
inputs:
|
|
variant:
|
|
description: "Étiquette de l'ISO (multi = tous les bureaux, le choix se fait à l'installation)"
|
|
required: false
|
|
default: multi
|
|
force:
|
|
description: "Publier même sans changement de ligne de version"
|
|
type: boolean
|
|
default: false
|
|
dry_run:
|
|
description: "Vérifier la chaîne sans builder ni publier"
|
|
type: boolean
|
|
default: false
|
|
build_only:
|
|
description: "Builder l'ISO sans publier (valide mkarchiso sur le runner)"
|
|
type: boolean
|
|
default: false
|
|
|
|
# One release at a time: a build holds root, loop devices and ~20 min.
|
|
concurrency:
|
|
group: release
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
release:
|
|
# Organisation runners: labels arch-host, ubuntu-latest, debian, alpine.
|
|
# mkarchiso needs an Arch environment, root, loop devices and mount, so the
|
|
# job must run privileged (act_runner: container.privileged = true).
|
|
runs-on: arch-host
|
|
timeout-minutes: 180
|
|
|
|
steps:
|
|
- name: Récupérer le dépôt avec ses tags
|
|
uses: actions/checkout@v4
|
|
with:
|
|
# The version-line rule reads the released tags.
|
|
fetch-depth: 0
|
|
|
|
- name: Git — accepter le dépôt monté par le runner
|
|
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}" || true
|
|
|
|
- name: Faut-il publier ?
|
|
id: check
|
|
env:
|
|
FORCE: ${{ inputs.force }}
|
|
run: |
|
|
# The version-line rule reads the released tags: a checkout without
|
|
# them (fetch-depth: 0 dropped) would see every VERSION as a new line
|
|
# and publish a patch release.
|
|
[ -n "$(git tag -l)" ] \
|
|
|| { echo "::error::aucun tag dans le checkout — fetch-depth: 0 est requis"; exit 1; }
|
|
if [ "${FORCE}" = "true" ]; then
|
|
./release.sh --check --force
|
|
else
|
|
./release.sh --check
|
|
fi
|
|
|
|
- name: Pré-vol du runner
|
|
if: steps.check.outputs.publish == 'true' || inputs.build_only
|
|
run: |
|
|
for c in bash curl jq git pacman; do
|
|
command -v "${c}" >/dev/null 2>&1 \
|
|
|| { echo "::error::${c} absent du runner"; exit 1; }
|
|
done
|
|
# mkarchiso needs root: either the job already runs as root, or the
|
|
# runner allows passwordless sudo.
|
|
[ "$(id -u)" -eq 0 ] || sudo -n true 2>/dev/null \
|
|
|| { echo "::error::mkarchiso exige root (job root ou sudo sans mot de passe)"; exit 1; }
|
|
|
|
# mkarchiso bind-mounts /proc and /dev inside the chroot and loops the
|
|
# squashfs. In a non-privileged container mount() is denied even as
|
|
# root, and the build only dies at pacstrap minutes later: check now.
|
|
SUDO=(); [ "$(id -u)" -eq 0 ] || SUDO=(sudo)
|
|
MP="$(mktemp -d)"
|
|
if ! MOUNT_ERR="$("${SUDO[@]}" mount -t tmpfs tmpfs "${MP}" 2>&1)"; then
|
|
rmdir "${MP}" 2>/dev/null || true
|
|
echo "::error::le runner refuse mount() : ${MOUNT_ERR}"
|
|
echo "::error::mkarchiso a besoin de CAP_SYS_ADMIN + des loop devices. Config act_runner : container.privileged: true puis redémarrer le daemon, ou enregistrer le label arch-host en mode host."
|
|
exit 1
|
|
fi
|
|
"${SUDO[@]}" umount "${MP}" && rmdir "${MP}"
|
|
|
|
- name: Dépendances de l'hôte (mkarchiso)
|
|
if: steps.check.outputs.publish == 'true' || inputs.build_only
|
|
run: |
|
|
# mkarchiso validates the host tools of every boot mode of the
|
|
# profile and aborts otherwise: grub-install (uefi.grub), mkfs.fat
|
|
# (dosfstools) and mcopy (mtools). --needed: no-op once present.
|
|
SUDO=(); [ "$(id -u)" -eq 0 ] || SUDO=(sudo)
|
|
"${SUDO[@]}" pacman -S --needed --noconfirm --quiet grub dosfstools mtools
|
|
|
|
- name: Build officiel et publication
|
|
if: steps.check.outputs.publish == 'true' || inputs.build_only
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.FWS_GITEA_TOKEN }}
|
|
GITHUB_TOKEN: ${{ secrets.FWS_GITHUB_TOKEN }}
|
|
VARIANT: ${{ inputs.variant || 'multi' }}
|
|
DRY_RUN: ${{ inputs.dry_run }}
|
|
BUILD_ONLY: ${{ inputs.build_only }}
|
|
run: |
|
|
if [ "${DRY_RUN}" = "true" ]; then
|
|
# Same preflight and notes as a real run, without the build or any
|
|
# publication: how the chain is validated after a change.
|
|
./release.sh --dry-run --variant "${VARIANT}"
|
|
elif [ "${BUILD_ONLY}" = "true" ]; then
|
|
# Proves the official build works on this runner and touches
|
|
# neither forge. The ISO itself is thrown away with the workspace.
|
|
FWS_ISO_VERSION="$(cat VERSION)" FWS_ISO_TAG="${VARIANT}" ./build-offi.sh
|
|
else
|
|
./release.sh --variant "${VARIANT}"
|
|
fi
|
|
|
|
- name: Résumé
|
|
if: steps.check.outputs.publish == 'true' || inputs.build_only
|
|
run: |
|
|
[ -n "${GITHUB_STEP_SUMMARY:-}" ] || exit 0
|
|
{
|
|
echo "### FWS $(cat VERSION)"
|
|
echo ""
|
|
echo "ISO : $(ls -1t out/v*/v*/*.iso 2>/dev/null | head -1)"
|
|
} >> "${GITHUB_STEP_SUMMARY}"
|
|
|
|
- name: Rendre le workspace au runner
|
|
if: always()
|
|
run: |
|
|
# The build runs as root: its artifacts stay root-owned in the
|
|
# workspace, and act_runner then fails to clean it up and cannot check
|
|
# the repository out for the next run. Hand them back unconditionally.
|
|
SUDO=(); [ "$(id -u)" -eq 0 ] || SUDO=(sudo)
|
|
"${SUDO[@]}" chown -R "$(id -u):$(id -g)" . 2>/dev/null || true
|
|
rm -rf out
|