Move group definitions into build.sh with other pkgs, and use gh actions to replace groupinstall with install <pkgs>

This commit is contained in:
badblocks 2024-10-30 13:33:31 -07:00
parent 79cc4b6ef0
commit 3fab4d535c
No known key found for this signature in database
3 changed files with 31 additions and 11 deletions

View file

@ -19,20 +19,42 @@ env:
IMAGE_REGISTRY: "ghcr.io/${{ github.repository_owner }}" # do not edit IMAGE_REGISTRY: "ghcr.io/${{ github.repository_owner }}" # do not edit
jobs: jobs:
read_groups:
name: Read RPM groups from build.sh
runs-on: ubuntu-latest
outputs:
groups: ${{ steps.extract_groups.outputs.result }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract quoted groups
id: extract_groups
run: |
# Find the rpm-ostree groupinstall lines and extract quoted strings
VALUE=$(grep '^rpm-ostree groupinstall' build.sh | grep -o '"[^"]*"' | tr '\n' ' ')
echo "result=$VALUE" >> "$GITHUB_OUTPUT"
get_pkg_lists: get_pkg_lists:
name: Retrieve group package lists from fedora:latest dnf group list name: Retrieve group package lists from fedora:latest dnf group list
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: fedora:latest container: fedora:latest
needs: read_groups
outputs: outputs:
GROUP_PKGS: ${{ steps.get_pkg_list.outputs.result }} GROUP_PKGS: ${{ steps.get_pkg_list.outputs.result }}
steps: steps:
- id: get_pkg_list - name: Get package lists from specified groups
run: | run: |
echo result=$((dnf group info "C Development Tools and Libraries" && dnf group info "Development Tools") | grep -v : | tr -d '\n' | tr -s ' ' | cut -c2-) > "$GITHUB_OUTPUT" read -r -a GROUPS <<< ${{ needs.read_groups.outputs.groups }}
for GROUP in "${GROUPS[@]}"; do
dnf group info "$GROUP" | grep -v : | tr -d '\n' | tr -s ' ' | cut -c2- >> "$GITHUB_OUTPUT"
done
build_push: build_push:
name: Build and push image name: Build and push image
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
needs: get_pkg_lists
permissions: permissions:
contents: read contents: read
@ -47,6 +69,10 @@ jobs:
- name: Maximize build space - name: Maximize build space
uses: ublue-os/remove-unwanted-software@v7 uses: ublue-os/remove-unwanted-software@v7
- name: Replace groupinstall <groups> with install <pkgs> in build.sh
run: |
sed "s/^rpm-ostree groupinstall.*/rpm-ostree install ${{ needs.get_pkg_lists.outputs.group_pkgs }}/" build.sh
- name: Generate tags - name: Generate tags
id: generate-tags id: generate-tags
shell: bash shell: bash
@ -119,8 +145,6 @@ jobs:
# Postfix image name with -custom to make it a little more descriptive # Postfix image name with -custom to make it a little more descriptive
# Syntax: https://docs.github.com/en/actions/learn-github-actions/expressions#format # Syntax: https://docs.github.com/en/actions/learn-github-actions/expressions#format
image: ${{ env.MY_IMAGE_NAME }} image: ${{ env.MY_IMAGE_NAME }}
build-args: |
GROUP_PKGS=${{ env.GROUP_PKGS }}
tags: | tags: |
${{ steps.generate-tags.outputs.alias_tags }} ${{ steps.generate-tags.outputs.alias_tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}

View file

@ -50,8 +50,6 @@ FROM ghcr.io/ublue-os/${SOURCE_IMAGE}${SOURCE_SUFFIX}:${FEDORA_VERSION}
COPY build.sh /tmp/build.sh COPY build.sh /tmp/build.sh
ARG GROUP_PKGS
RUN mkdir -p /var/lib/alternatives && \ RUN mkdir -p /var/lib/alternatives && \
/tmp/build.sh && \ /tmp/build.sh && \
ostree container commit ostree container commit

View file

@ -39,10 +39,8 @@ rpm-ostree install \
htop \ htop \
glances glances
# from dnf groups (specify in build.yml) # from dnf groups (gh actions will translate this to rpm-ostree install <pkgs>)
if [ -n "$GROUP_PKGS"]; then rpm-ostree groupinstall "C Development Tools and Libraries" "Development Tools"
rpm-ostree install $GROUP_PKGS
fi
# from rpmfusion # from rpmfusion
rpm-ostree install vlc rpm-ostree install vlc