diff --git a/.github/workflows/build-gnome.yml b/.github/workflows/build-gnome.yml index 5a6fe21..18cee0b 100644 --- a/.github/workflows/build-gnome.yml +++ b/.github/workflows/build-gnome.yml @@ -19,20 +19,42 @@ env: IMAGE_REGISTRY: "ghcr.io/${{ github.repository_owner }}" # do not edit 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: name: Retrieve group package lists from fedora:latest dnf group list runs-on: ubuntu-latest container: fedora:latest + needs: read_groups outputs: GROUP_PKGS: ${{ steps.get_pkg_list.outputs.result }} steps: - - id: get_pkg_list + - name: Get package lists from specified groups 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: name: Build and push image runs-on: ubuntu-24.04 + needs: get_pkg_lists permissions: contents: read @@ -47,6 +69,10 @@ jobs: - name: Maximize build space uses: ublue-os/remove-unwanted-software@v7 + - name: Replace groupinstall with install in build.sh + run: | + sed "s/^rpm-ostree groupinstall.*/rpm-ostree install ${{ needs.get_pkg_lists.outputs.group_pkgs }}/" build.sh + - name: Generate tags id: generate-tags shell: bash @@ -119,8 +145,6 @@ jobs: # Postfix image name with -custom to make it a little more descriptive # Syntax: https://docs.github.com/en/actions/learn-github-actions/expressions#format image: ${{ env.MY_IMAGE_NAME }} - build-args: | - GROUP_PKGS=${{ env.GROUP_PKGS }} tags: | ${{ steps.generate-tags.outputs.alias_tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Containerfile b/Containerfile index f47d176..1547d77 100644 --- a/Containerfile +++ b/Containerfile @@ -50,8 +50,6 @@ FROM ghcr.io/ublue-os/${SOURCE_IMAGE}${SOURCE_SUFFIX}:${FEDORA_VERSION} COPY build.sh /tmp/build.sh -ARG GROUP_PKGS - RUN mkdir -p /var/lib/alternatives && \ /tmp/build.sh && \ ostree container commit diff --git a/build.sh b/build.sh index 2b6a7e0..819791c 100755 --- a/build.sh +++ b/build.sh @@ -39,10 +39,8 @@ rpm-ostree install \ htop \ glances -# from dnf groups (specify in build.yml) -if [ -n "$GROUP_PKGS"]; then - rpm-ostree install $GROUP_PKGS -fi +# from dnf groups (gh actions will translate this to rpm-ostree install ) +rpm-ostree groupinstall "C Development Tools and Libraries" "Development Tools" # from rpmfusion rpm-ostree install vlc