Skip to content

Commit

Permalink
chore(ci): use flatpak upload folder instead
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmiller committed Apr 6, 2024
1 parent 4f5045d commit b56259c
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 35 deletions.
121 changes: 86 additions & 35 deletions .github/workflows/build_iso.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,33 +77,78 @@ jobs:
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- name: Set Flatpaks Directory Shortname
id: generate-flatpak-dir-shortname
shell: bash
run: |
FLATPAK_DIR_SHORTNAME="gnome_flatpaks"
# preparing for aurora
if [[ "${{ matrix.image_name }}" =~ "aurora" ]]; then
FLATPAK_DIR_SHORTNAME="kde_flatpaks"
fi
echo "flatpak-dir-shortname=${FLATPAK_DIR_SHORTNAME}" >> $GITHUB_OUTPUT
# Removing to debug, will add back once working
# - name: Determine Flatpak Dependencies
# id: flatpak_dependencies
# uses: jasonn3/build-container-installer@deps
# with:
# arch: x86_64
# image_name: ${{ matrix.image_name }}
# image_repo: ghcr.io/ublue-os
# variant: 'Silverblue'
# version: ${{ matrix.major_version }}
# image_tag: ${{ steps.generate-tag.outputs.tag }}
# secure_boot_key_url: 'https://github.com/ublue-os/akmods/raw/main/certs/public_key.der'
# enrollment_password: 'ublue-os'
# make_target: flatpaks/full_list
# enable_cache_dnf: "false"
# enable_cache_skopeo: "false"
# flatpak_remote_refs_dir: flatpaks

# - name: Filter Flatpak list
# id: filtered_flatpak_dependencies
# shell: bash
# run: |
# newlist=$(echo ${{ steps.flatpak_dependencies.outputs.flatpak_refs }} | \
# tr ' ' '\n' | \
# grep -v 'org\.freedesktop\.Platform\.openh264' | \
# tr '\n' ' ')
# echo "filtered_flatpak_refs=${newlist}" >> $GITHUB_OUTPUT

- name: Determine Flatpak Dependencies
id: flatpak_dependencies
uses: jasonn3/build-container-installer@deps
with:
arch: x86_64
image_name: ${{ matrix.image_name }}
image_repo: ghcr.io/ublue-os
variant: 'Silverblue'
version: ${{ matrix.major_version }}
image_tag: ${{ steps.generate-tag.outputs.tag }}
secure_boot_key_url: 'https://github.com/ublue-os/akmods/raw/main/certs/public_key.der'
enrollment_password: 'ublue-os'
make_target: flatpaks/full_list
enable_cache_dnf: "false"
enable_cache_skopeo: "false"
flatpak_remote_refs_dir: flatpaks

- name: Filter Flatpak list
id: filtered_flatpak_dependencies
shell: bash
run: |
newlist=$(echo ${{ steps.flatpak_dependencies.outputs.flatpak_refs }} | \
tr ' ' '\n' | \
grep -v 'org\.freedesktop\.Platform\.openh264' | \
tr '\n' ' ')
echo "filtered_flatpak_refs=${newlist}" >> $GITHUB_OUTPUT
set -ex
image="ghcr.io/ublue-os/${{ matrix.image_name }}:${{ steps.generate-tag.outputs.tag }}"
# Make temp space
TEMP_FLATPAK_INSTALL_DIR=$(mktemp -d -p ${{ github.workspace }} flatpak.XXX)
# Get list of refs from directory
FLATPAK_REFS_DIR=${{ github.workspace }}/${{ steps.generate-flatpak-dir-shortname.outputs.flatpak-dir-shortname }}
FLATPAK_REFS_DIR_LIST=$(cat ${FLATPAK_REFS_DIR}/* | tr '\n' ' ' )
# Generate install script
cat << EOF > ${TEMP_FLATPAK_INSTALL_DIR}/script.sh
cat /temp_flatpak_install_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 flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --system -y ${FLATPAK_REFS_DIR_LIST}
ostree refs --repo=\${FLATPAK_SYSTEM_DIR}/repo | grep '^deploy/' | grep -v 'org\.freedesktop\.Platform\.openh264' | sed 's/^deploy\///g' > /output/flatpaks_with_deps
EOF
docker run --rm --privileged \
--entrypoint bash \
-e FLATPAK_SYSTEM_DIR=/flatpak/flatpak \
-e FLATPAK_TRIGGERSDIR=/flatpak/triggers \
--volume ${FLATPAK_REFS_DIR}:/output \
--volume ${TEMP_FLATPAK_INSTALL_DIR}:/temp_flatpak_install_dir \
${image} /temp_flatpak_install_dir/script.sh
docker rmi ${image}
- name: Build ISOs
uses: jasonn3/build-container-installer@main
id: build
Expand All @@ -116,21 +161,31 @@ jobs:
image_tag: ${{ steps.generate-tag.outputs.tag }}
secure_boot_key_url: 'https://github.com/ublue-os/akmods/raw/main/certs/public_key.der'
enrollment_password: 'ublue-os'
iso_name: ${{ matrix.image_name }}-${{ steps.generate-tag.outputs.tag }}.iso
## iso_name: ${{ matrix.image_name }}-${{ steps.generate-tag.outputs.tag }}.iso
iso_name: ${{ matrix.image_name }}-${{ steps.generate-tag.outputs.tag }}
enable_cache_dnf: "false"
enable_cache_skopeo: "false"
flatpak_remote_refs: ${{ steps.filtered_flatpak_dependencies.outputs.filtered_flatpak_refs }}
## flatpak_remote_refs: ${{ steps.filtered_flatpak_dependencies.outputs.filtered_flatpak_refs }}
flatpak_remote_refs_dir: /github/workspace/${{ steps.generate-flatpak-dir-shortname.outputs.flatpak-dir-shortname }}
enable_flatpak_dependencies: "false"

- name: Move ISOs to Upload Directory
id: upload-directory
shell: bash
run: |
ISO_UPLOAD_DIR=${{ github.workspace }}/upload
mkdir ${ISO_UPLOAD_DIR}
mv ${{ steps.build.outputs.iso_path }} ${ISO_UPLOAD_DIR}
mv ${{ steps.build.outputs.iso_path }}-CHECKSUM ${ISO_UPLOAD_DIR}
echo "iso-upload-dir=${ISO_UPLOAD_DIR}" >> $GITHUB_OUTPUT
- name: Upload ISOs and Checksum to Job Artifacts
if: github.ref_name == 'testing'
#if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.iso_name }}
path: |
${{ steps.build.outputs.iso_path }}/${{ steps.build.outputs.iso_name }}
${{ steps.build.outputs.iso_path }}/${{ steps.build.outputs.iso_name }}-CHECKSUM
name: ${{ matrix.image_name }}-${{ steps.generate-tag.outputs.tag }}-${{ matrix.major_version}}
path: ${{ steps.upload-directory.outputs.iso-upload-dir }}
if-no-files-found: error
retention-days: 0
compression-level: 0
Expand All @@ -146,12 +201,8 @@ jobs:
RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
RCLONE_CONFIG_R2_REGION: auto
RCLONE_CONFIG_R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }}
SOURCE_ISO_NAME: ${{ steps.build.outputs.iso_name }}
SOURCE_ISO_CHECKSUM: ${{ steps.build.outputs.iso_name }}-CHECKSUM
SOURCE_ISO_PATH: ${{ steps.build.outputs.iso_path }}/${{ steps.build.outputs.iso_name }}
SOURCE_ISO_CHECKSUM_PATH: ${{ steps.build.outputs.iso_path }}/${{ steps.build.outputs.iso_name }}-CHECKSUM
SOURCE_DIR: ${{ steps.upload-directory.outputs.iso-upload-dir }}
run: |
sudo apt-get update
sudo apt-get install -y rclone
rclone copyto --s3-no-check-bucket --progress $SOURCE_ISO_PATH R2:bluefin/$SOURCE_ISO_NAME && \
rclone copyto --s3-no-check-bucket --progress $SOURCE_ISO_CHECKSUM_PATH R2:bluefin/$SOURCE_ISO_CHECKSUM
rclone copy $SOURCE_DIR R2:bluefin
File renamed without changes.

0 comments on commit b56259c

Please sign in to comment.