-
-
Notifications
You must be signed in to change notification settings - Fork 243
169 lines (151 loc) · 6.35 KB
/
build_iso.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: Build ISOs
on:
workflow_dispatch:
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}-iso
cancel-in-progress: true
jobs:
build-iso:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false
matrix:
image_name:
- bazzite
- bazzite-nvidia
- bazzite-gnome
- bazzite-gnome-nvidia
- bazzite-deck
- bazzite-deck-gnome
- bazzite-ally
- bazzite-ally-gnome
- bazzite-asus
- bazzite-gnome-asus
- bazzite-asus-nvidia
- bazzite-gnome-asus-nvidia
major_version: [40]
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@v1.3.1
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set Image Tag
id: generate-tag
shell: bash
run: |
TAG="stable"
if [[ "${{ github.ref_name }}" == "testing" ]]; then
TAG="testing"
fi
# Would like to implement in the future. This will allow us to support image tags from a PR.
#if [[ github.event.number ]]; then
# TAG="pr-${{ github.event.number }}-${{ matrix.major_version }}"
#fi
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- name: Set EXTRA_BOOT_PARAMS
id: generate-extra-params
shell: bash
run: |
EXTRA_BOOT_PARAMS=""
if [[ "${{ matrix.image_name }}" =~ "deck" ]]; then
EXTRA_BOOT_PARAMS="inst.resolution=1280x800"
fi
echo "extra-boot-params=${EXTRA_BOOT_PARAMS}" >> $GITHUB_OUTPUT
- name: Set Flatpaks Directory Shortname
id: generate-flatpak-dir-shortname
shell: bash
run: |
FLATPAK_DIR_SHORTNAME="installer/kde_flatpaks"
if [[ "${{ matrix.image_name }}" =~ "gnome" ]]; then
FLATPAK_DIR_SHORTNAME="installer/gnome_flatpaks"
fi
echo "flatpak-dir-shortname=${FLATPAK_DIR_SHORTNAME}" >> $GITHUB_OUTPUT
- name: Determine Flatpak Dependencies
id: flatpak_dependencies
shell: bash
run: |
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@v1.2.0
id: build
with:
arch: x86_64
image_name: ${{ matrix.image_name }}
image_repo: ghcr.io/ublue-os
variant: 'Kinoite'
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'
iso_name: ${{ matrix.image_name }}-${{ steps.generate-tag.outputs.tag }}.iso
enable_cache_dnf: "false"
enable_cache_skopeo: "false"
flatpak_remote_refs_dir: ${{ steps.generate-flatpak-dir-shortname.outputs.flatpak-dir-shortname }}
enable_flatpak_dependencies: "false"
extra_boot_params: ${{ steps.generate-extra-params.outputs.extra-boot-params }}
additional_templates: 'installer/lorax_templates/remote_root_password_prompt.tmpl'
- 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 }}/${{ steps.build.outputs.iso_name }} ${ISO_UPLOAD_DIR}
mv ${{ steps.build.outputs.iso_path }}/${{ steps.build.outputs.iso_name }}-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: ${{ 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
overwrite: true
- name: Upload ISOs and Checksum to R2
if: github.event_name == 'workflow_dispatch' && github.ref_name == 'main'
shell: bash
env:
RCLONE_CONFIG_R2_TYPE: s3
RCLONE_CONFIG_R2_PROVIDER: Cloudflare
RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
RCLONE_CONFIG_R2_REGION: auto
RCLONE_CONFIG_R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }}
SOURCE_DIR: ${{ steps.upload-directory.outputs.iso-upload-dir }}
run: |
sudo apt-get update
sudo apt-get install -y rclone
rclone copy $SOURCE_DIR R2:bazzite