62 lines
2.2 KiB
YAML
62 lines
2.2 KiB
YAML
stages:
|
|
- build
|
|
- deploy
|
|
|
|
image: archlinux/archlinux:base-devel
|
|
|
|
variables:
|
|
ARCHITECTURES: "aarch64 rpi-aarch64" # Set architectures for the matrix
|
|
FLAVORS: "barebone plasma xfce trinity" # Set flavors to simulate a matrix
|
|
Remote_Path: "/srv/http/arm/"
|
|
|
|
# Build stage: builds ISO files for multiple architectures and flavors
|
|
build_iso:
|
|
stage: build
|
|
script:
|
|
- pacman -Sy parted wget dosfstools zip arch-install-scripts aria2 git --noconfirm
|
|
- echo "Starting ISO build for ARM platforms"
|
|
- for arch in $ARCHITECTURES; do
|
|
for flavor in $FLAVORS; do
|
|
scripts=();
|
|
for script_name in "$arch" "$flavor" "$arch-$flavor"; do
|
|
script_path="setup/$script_name";
|
|
if [ -f "$script_path" ]; then
|
|
scripts+=("$script_path");
|
|
fi;
|
|
done;
|
|
echo "Building image for $arch with $flavor";
|
|
sudo ./create-image 9G "$arch" "${scripts[@]}";
|
|
image_in_name="archlinux-${arch}.img";
|
|
image_out_name="ParchLinux-${arch}-${flavor}-$(date '+%Y-%m-%d').img";
|
|
mv "$image_in_name" "$image_out_name";
|
|
echo "Compressing $image_out_name with xz";
|
|
xz -z "$image_out_name";
|
|
done;
|
|
done;
|
|
artifacts:
|
|
paths:
|
|
- "*.img.xz" # Save all .xz compressed images as artifacts
|
|
rules:
|
|
- if: $CI_COMMIT_TAG # Only run on tag pushes
|
|
|
|
deploy_iso:
|
|
stage: deploy
|
|
dependencies:
|
|
- build_iso # Deploy depends on the build_iso job completion
|
|
script:
|
|
- echo "Installing sshpass and rsync"
|
|
- pacman -Syu --noconfirm sshpass rsync
|
|
- echo "Removing old ISO files from remote directory"
|
|
- sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no parch@$SSH_ROOT "rm -rf $Remote_Path"
|
|
- echo "Creating new directory on remote host"
|
|
- sshpass -p "$PASS" ssh -o StrictHostKeyChecking=no parch@$SSH_ROOT "mkdir -p $Remote_Path"
|
|
- echo "Uploading new compressed images via rsync"
|
|
- for arch in $ARCHITECTURES; do
|
|
for flavor in $FLAVORS; do
|
|
image_file="ParchLinux-${arch}-${flavor}-$(date '+%Y-%m-%d').img.xz";
|
|
sshpass -p "$PASS" rsync -r "$image_file" parch@$SSH_ROOT:$Remote_Path;
|
|
done;
|
|
done;
|
|
rules:
|
|
- if: $CI_COMMIT_TAG # Only run on tag pushes
|
|
|