mirror of
https://github.com/JasonN3/build-container-installer.git
synced 2025-12-25 02:47:56 +01:00
Split Makfile and move workflow to Makefile (#88)
Co-authored-by: codacy-production[bot] <61871480+codacy-production[bot]@users.noreply.github.com>
This commit is contained in:
parent
662f1a94e4
commit
b669420287
40 changed files with 800 additions and 665 deletions
101
action.yml
101
action.yml
|
|
@ -44,7 +44,7 @@ inputs:
|
|||
required: false
|
||||
default: ""
|
||||
flatpak_remote_refs_dir:
|
||||
description: Directory that contains files that list the flatpak refs to install
|
||||
description: Directory that contains files that list the flatpak refs to install relative to the github workspace
|
||||
required: false
|
||||
default: ""
|
||||
flatpak_remote_url:
|
||||
|
|
@ -66,11 +66,15 @@ inputs:
|
|||
description: "Name of the resulting ISO. Relative paths are relative to github.workspace"
|
||||
required: false
|
||||
default: build/deploy.iso
|
||||
make_target:
|
||||
description: "Overrides the default make target"
|
||||
required: false
|
||||
repos:
|
||||
description: List of repo files for Lorax to use
|
||||
required: false
|
||||
rootfs_size:
|
||||
description: The size (in GiB) for the squashfs runtime volume
|
||||
default: "2"
|
||||
secure_boot_key_url:
|
||||
description: Secure boot key that is installed from URL location
|
||||
required: false
|
||||
|
|
@ -92,11 +96,14 @@ inputs:
|
|||
|
||||
outputs:
|
||||
iso_name:
|
||||
value: ${{ steps.rename_iso.outputs.iso_name }}
|
||||
value: ${{ steps.docker.outputs.iso_name }}
|
||||
description: The name of the resulting .iso
|
||||
iso_path:
|
||||
value: ${{ steps.rename_iso.outputs.iso_path }}
|
||||
description: The name and path of the resulting .iso
|
||||
value: ${{ steps.docker.outputs.iso_path }}
|
||||
description: The path of the resulting .iso
|
||||
flatpak_refs:
|
||||
value: ${{ steps.docker.outputs.flatpak_refs }}
|
||||
description: The list of Flatpak refs
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
|
@ -139,45 +146,25 @@ runs:
|
|||
id: flatpak_dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
image="${{ inputs.image_repo }}/${{ inputs.image_name }}:${{ inputs.image_tag }}"
|
||||
# Make temp space
|
||||
FLATPAK_DIR=$(basename $(mktemp -d -p ${{ github.workspace }} flatpak.XXX))
|
||||
# Get list of refs from directory
|
||||
sudo mkdir /github || true
|
||||
sudo ln -s ${{ github.workspace }} /github/workspace
|
||||
DIR_REFS=$(cat ${{ inputs.flatpak_remote_refs_dir }}/* | tr '\n' ' ' )
|
||||
# Generate install script
|
||||
cat << EOF > ${{ github.workspace }}/${FLATPAK_DIR}/script.sh
|
||||
cat /flatpak_dir/script.sh
|
||||
mkdir -p /flatpak/flatpak /flatpak/triggers
|
||||
mkdir /var/tmp || true
|
||||
chmod -R 1777 /var/tmp
|
||||
flatpak config --system --set languages "*"
|
||||
flatpak remote-add --system ${{ inputs.flatpak_remote_name }} ${{ inputs.flatpak_remote_url }}
|
||||
flatpak install --system -y ${{ inputs.flatpak_remote_refs }} ${DIR_REFS}
|
||||
ostree init --repo=/flatpak_dir/repo --mode=archive-z2
|
||||
for i in \$(ostree refs --repo=\${FLATPAK_SYSTEM_DIR}/repo | grep '^deploy/' | sed 's/^deploy\///g')
|
||||
do
|
||||
echo "Copying \${i}..."
|
||||
ostree --repo=/flatpak_dir/repo pull-local \${FLATPAK_SYSTEM_DIR}/repo \$(ostree --repo=\${FLATPAK_SYSTEM_DIR}/repo rev-parse ${{ inputs.flatpak_remote_name }}/\${i})
|
||||
mkdir -p \$(dirname /flatpak_dir/repo/refs/heads/\${i})
|
||||
ostree --repo=\${FLATPAK_SYSTEM_DIR}/repo rev-parse ${{ inputs.flatpak_remote_name }}/\${i} > /flatpak_dir/repo/refs/heads/\${i}
|
||||
done
|
||||
flatpak build-update-repo /flatpak_dir/repo
|
||||
ostree refs --repo=/flatpak_dir/repo
|
||||
EOF
|
||||
docker run --rm --privileged --entrypoint bash -e FLATPAK_SYSTEM_DIR=/flatpak/flatpak -e FLATPAK_TRIGGERSDIR=/flatpak/triggers --volume ${{ github.workspace }}/${FLATPAK_DIR}:/flatpak_dir ${image} /flatpak_dir/script.sh
|
||||
echo "flatpak_dir=${FLATPAK_DIR}" >> $GITHUB_OUTPUT
|
||||
docker rmi ${image}
|
||||
cd ${{ github.action_path }}
|
||||
make flatpaks/repo \
|
||||
FLATPAK_REMOTE_NAME="${{ inputs.flatpak_remote_name }}" \
|
||||
${{ inputs.flatpak_remote_refs && format('FLATPAK_REMOTE_REFS="{0}"', inputs.flatpak_remote_refs) || ''}} \
|
||||
${{ inputs.flatpak_remote_refs_dir && format('FLATPAK_REMOTE_REFS_DIR="{0}"', inputs.flatpak_remote_refs_dir) || ''}} \
|
||||
FLATPAK_REMOTE_URL="${{ inputs.flatpak_remote_url }}" \
|
||||
IMAGE_NAME="${{ inputs.image_name }}" \
|
||||
IMAGE_REPO="${{ inputs.image_repo }}" \
|
||||
IMAGE_TAG="${{ inputs.image_tag || inputs.version }}"
|
||||
|
||||
- name: Run docker image
|
||||
id: docker
|
||||
env:
|
||||
ACTION_REPO: ${{ github.action_repository }}
|
||||
ACTION_REF: ${{ github.action_ref }}
|
||||
shell: bash
|
||||
run: |
|
||||
image=$(echo "ghcr.io/${ACTION_REPO}" | tr [:upper:] [:lower:])
|
||||
# Check if running inside01 of the action repo
|
||||
# Check if running inside of the action repo
|
||||
if [[ -z "${ACTION_REPO}" ]]
|
||||
then
|
||||
image=$(echo "ghcr.io/${{ github.repository }}" | tr [:upper:] [:lower:])
|
||||
|
|
@ -209,22 +196,38 @@ runs:
|
|||
exit 1
|
||||
fi
|
||||
docker run --privileged --volume ${{ github.workspace }}:/github/workspace/ ${cache} ${image}:${tag} \
|
||||
${{ inputs.make_target }} \
|
||||
ADDITIONAL_TEMPLATES="${{ inputs.additional_templates }}" \
|
||||
ARCH="${{ inputs.arch }}" \
|
||||
DNF_CACHE="/cache/dnf" \
|
||||
ENROLLMENT_PASSWORD="${{ inputs.enrollment_password }}" \
|
||||
EXTRA_BOOT_PARAMS="${{ inputs.extra_boot_params }}" \
|
||||
FLATPAK_REMOTE_NAME="${{ inputs.flatpak_remote_name }}" \
|
||||
FLATPAK_REMOTE_REFS="${{ inputs.flatpak_remote_refs }}" \
|
||||
FLATPAK_REMOTE_REFS_DIR="${{ inputs.flatpak_remote_refs_dir }}" \
|
||||
${{ inputs.flatpak_remote_refs && format('FLATPAK_REMOTE_REFS="{0}"', inputs.flatpak_remote_refs) || ''}} \
|
||||
${{ inputs.flatpak_remote_refs_dir && format('FLATPAK_REMOTE_REFS_DIR="/github/workspace/{0}"', inputs.flatpak_remote_refs_dir) || ''}} \
|
||||
FLATPAK_REMOTE_URL="${{ inputs.flatpak_remote_url }}" \
|
||||
FLATPAK_DIR="${{ steps.flatpak_dependencies.outputs.flatpak_dir && format('/github/workspace/{0}', steps.flatpak_dependencies.outputs.flatpak_dir) || '' }}" \
|
||||
IMAGE_NAME="${{ inputs.image_name }}" \
|
||||
IMAGE_REPO="${{ inputs.image_repo }}" \
|
||||
IMAGE_TAG="${{ inputs.image_tag || inputs.version }}" \
|
||||
ISO_NAME=/github/workspace/${{ inputs.iso_name }} \
|
||||
SECURE_BOOT_KEY_URL="${{ inputs.secure_boot_key_url }}" \
|
||||
VARIANT="${{ inputs.variant }}" \
|
||||
VERSION="${{ inputs.version }}" \
|
||||
WEB_UI="${{ inputs.web_ui }}"
|
||||
echo "iso_path=$(dirname ${{ inputs.iso_name }})" >> $GITHUB_OUTPUT
|
||||
echo "iso_name=$(basename ${{ inputs.iso_name }})" >> $GITHUB_OUTPUT
|
||||
if [[ "${{ steps.flatpak_dependencies.outputs.flatpak_dir }}" != '' ]]
|
||||
then
|
||||
echo "flatpak_refs=$(cat ${{ github.workspace }}/${{ steps.flatpak_dependencies.outputs.flatpak_dir }}/list.txt | tr '\n' ' ')" >> $GITHUB_OUTPUT
|
||||
else
|
||||
if [[ "${{ inputs.flatpak_remote_refs_dir }}" != '' ]]
|
||||
then
|
||||
echo "flatpak_refs=$(cat ${{ github.workspace }}/${{ inputs.flatpak_remote_refs_dir }}/* | tr '\n' ' ')" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "flatpak_refs=${{ inputs.flatpak_remote_refs}}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Save dnf cache
|
||||
env:
|
||||
|
|
@ -243,27 +246,3 @@ runs:
|
|||
with:
|
||||
path: /cache/skopeo
|
||||
key: ${{ inputs.skopeo_cache_key || env.skopeo_cache_key }}
|
||||
|
||||
|
||||
- name: Rename ISO file
|
||||
id: rename_iso
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ ! ( "${{ inputs.iso_name }}" =~ \.iso$ ) ]]
|
||||
then
|
||||
iso_name="${{ inputs.iso_name }}.iso"
|
||||
else
|
||||
iso_name="${{ inputs.iso_name }}"
|
||||
fi
|
||||
if [[ "${{ inputs.iso_name }}" =~ ^/ ]]
|
||||
then
|
||||
full_path="${iso_name}"
|
||||
else
|
||||
full_path="${{ github.workspace }}/${iso_name}"
|
||||
fi
|
||||
mv ${{ github.workspace }}/build/deploy.iso ${full_path} || true
|
||||
cd $(dirname ${full_path})
|
||||
iso_fn=$(basename ${iso_name})
|
||||
sha256sum ${iso_fn} > ${iso_fn}-CHECKSUM
|
||||
echo "iso_path=${full_path}" >> $GITHUB_OUTPUT
|
||||
echo "iso_name=${iso_fn}" >> $GITHUB_OUTPUT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue