forked from stable-os/mirror-fedora-ostree-oci-images
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (80 loc) · 2.8 KB
/
build.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
name: build-ublue
on:
workflow_dispatch:
pull_request:
branches:
- main
paths-ignore:
- '**.md'
- '**.txt'
schedule:
- cron: '20 20 * * *' # 8:20pm everyday
push:
branches:
- main
paths-ignore:
- '**.md'
- '**.txt'
env:
IMAGE_BASE_NAME: main
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
jobs:
push-ghcr:
name: Build and push image
runs-on: ubuntu-22.04
#container:
# image: fedora:${{ matrix.image_version }} #quay.io/fedora-ostree-desktops/buildroot
# # Privilleged
# options: --privileged --platform linux/${{ matrix.arch }}
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false
matrix:
image_name: [silverblue, kinoite, sericea, vauxite, base]
arch: [x86_64, arm64]
# Change this to the branch's version!
version: [39]
image_version: [rawhide]
steps:
# Checkout push-to-registry action GitHub repository
- name: Checkout Push to Registry action
uses: actions/checkout@v3
# Setup qemu
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build Docker image
run: |
docker build --platform linux/${{ matrix.arch }} -t buildroot --build-arg FEDORA_IMAGE_VERSION=${{ matrix.image_version }} --build-arg FEDORA_IMAGE_ARCH=${{ matrix.arch }} --build-arg IMAGE_TYPE=${{ matrix.image_name }} .
- name: Build image
run: |
docker run --privileged --platform linux/${{ matrix.arch }} --name buildroot --volume $PWD:/build_dir buildroot
- name: Import image
run: |
cat fedora-${{ matrix.image_name }}.ociarchive | podman import - fedora-ostree-desktop-${{ matrix.image_name}}:latest-${{ matrix.version }}-${{ matrix.arch }}
# Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR.
# https://github.com/macbre/push-to-ghcr/issues/12
- name: Lowercase Registry
id: registry_case
uses: ASzc/change-string-case-action@v5
with:
string: ${{ env.IMAGE_REGISTRY }}
# Push the image to GHCR (Image Registry)
- name: Push To GHCR
uses: redhat-actions/push-to-registry@v2
id: push
#if: github.event_name != 'pull_request'
env:
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
with:
image: fedora-ostree-desktop-${{ matrix.image_name}}
tags: latest-${{ matrix.version }}-${{ matrix.arch }}
registry: ${{ steps.registry_case.outputs.lowercase }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
extra-args: |
--disable-content-trust