-
-
Notifications
You must be signed in to change notification settings - Fork 9
186 lines (166 loc) · 5.35 KB
/
build-docker.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Build Docker images
env:
KATSU_BUILD_TASK_NAME: "Build image"
DNF_PKGS: |
git
xorriso
limine
btrfs-progs
e2fsprogs
xfsprogs
dosfstools
grub2
parted
util-linux-core
grub2-efi
uboot-images-armv8
uboot-tools
qemu-user-static-aarch64
qemu-user-binfmt
qemu-kvm
qemu-img
systemd-devel
mkpasswd
squashfs-tools
erofs-utils
grub2-tools
grub2-tools-extra
isomd5sum
podman
katsu
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-41.noarch.rpm
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-41.noarch.rpm
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
on:
push:
branches: ["um41"]
workflow_dispatch:
pull_request:
branches: ["um41"]
jobs:
#### DOCKER ######
docker:
strategy:
fail-fast: false
matrix:
variant:
- base/base-docker-x86_64
- base/base-docker-aarch64
outputs:
artifact: ${{ matrix.variant }}
# ubuntu-latest unless we're building aarch64
runs-on: ${{ endsWith(matrix.variant, '-aarch64') && 'arm64' || 'ubuntu-latest' }}
container:
image: ghcr.io/terrapkg/builder:f41
# Pass /dev from host to container
# Very hacky, but it works
# Microsoft/Github, if you're reading this,
# I'm sorry.
options: --privileged -v /dev:/dev
steps:
- name: Install dependencies
run: |
dnf up -y
dnf install -y $DNF_PKGS
dnf clean all
- name: Checkout
uses: actions/checkout@v4
- name: sanitize artifact name
run: |
name=$(echo ${{ matrix.variant }} | sed 's/\//-/g')
# set github variable
echo artifact=$name >> $GITHUB_ENV
# get architecture
# e.g. base/base-docker-x86_64 -> x86_64
echo arch=$(echo ${{ matrix.variant }} | cut -d'-' -f3) >> $GITHUB_ENV
- name: ${{ env.KATSU_BUILD_TASK_NAME }}
run: |
pushd katsu
katsu --output=fs modules/${{ matrix.variant }}.yaml
if [ ${{ env.arch }} == "x86_64" ]; then
host_arch="amd64"
elif [ ${{ env.arch }} == "aarch64" ]; then
host_arch="arm64"
fi
# tarball katsu-work/chroot then import using podman with tag ghcr.io/ultramarine-linux/ultramarine:41
tar -C katsu-work/chroot -c . | podman import --change='CMD ["/usr/bin/bash"]' - ghcr.io/ultramarine-linux/ultramarine:41 --arch $host_arch
podman save --format oci-archive ghcr.io/ultramarine-linux/ultramarine:41 --output katsu-work/image/katsu.tar.xz
popd
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact }}-docker
path: katsu/katsu-work/image/*.tar.xz
compression-level: 0
#### DOCKER PUSH ######
docker-push:
runs-on: ubuntu-latest
needs: docker
if: github.event_name != 'pull_request'
steps:
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y buildah
- name: Log in to ghcr.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
# how do i combine those two images into one multiarch tag
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Publish to registry
run: |
set -x
MANIFEST="ghcr.io/ultramarine-linux/ultramarine"
RELEASE="41"
ls -lR
buildah manifest create $MANIFEST
buildah manifest add $MANIFEST oci-archive:base-base-docker-x86_64-docker/katsu.tar.xz --arch amd64
buildah manifest add $MANIFEST oci-archive:base-base-docker-aarch64-docker/katsu.tar.xz --arch arm64
# also tag as latest
buildah tag $MANIFEST $MANIFEST:latest || :
buildah manifest push --all --format v2s2 $MANIFEST docker://$MANIFEST:$RELEASE
docker-layer:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
needs: docker-push
strategy:
fail-fast: true
matrix:
version:
- 41
docker:
- dockerfile: dockerfiles/devtools.dockerfile
image: ghcr.io/ultramarine-linux/ultramarine-devtools
- dockerfile: dockerfiles/gitpod.dockerfile
image: ghcr.io/ultramarine-linux/ultramarine-gitpod
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build images
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.docker.dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ matrix.docker.image }}:${{ matrix.version }}
${{ matrix.docker.image }}:latest
build-args: |
RELEASE=${{ matrix.version }}
#### LIVE ISO ####