Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
matrix:
image_name: [silverblue, kinoite, vauxite, sericea, base, lxqt, mate]
major_version: [37, 38]
platform: ["linux/amd64", "linux/arm64"]
include:
- major_version: 37
is_latest_version: true
Expand All @@ -49,6 +50,9 @@ jobs:
- name: Checkout Push to Registry action
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Matrix Variables
run: |
if [[ "${{ matrix.image_name }}" == "lxqt" || "${{ matrix.image_name }}" == "mate" ]]; then
Expand All @@ -58,30 +62,46 @@ jobs:
fi
echo "IMAGE_NAME=${{ format('{0}-{1}', matrix.image_name, env.IMAGE_BASE_NAME) }}" >> $GITHUB_ENV

- name: Run find-and-replace to remove linux/ from arch
uses: mad9000/actions-find-and-replace-string@1
id: arch
with:
source: ${{ matrix.platform }}
find: 'linux/'
replace: ''

- name: Generate tags
id: generate-tags
shell: bash
run: |
PLAFTORM_TAG=""
UNCLEAN_PLATFORM="${{ matrix.platform }}"
CLEANED_PLATFORM="${UNCLEAN_PLATFORM/"linux/"/""}"
if ! [[ "$UNCLEAN_PLATFORM" == "linux/amd64" ]]; then
PLAFTORM_TAG="-$CLEANED_PLATFORM"
fi

# Generate a timestamp for creating an image version history
TIMESTAMP="$(date +%Y%m%d)"
MAJOR_VERSION="${{ matrix.major_version }}"
COMMIT_TAGS=()
BUILD_TAGS=()
# Have tags for tracking builds during pull request
SHA_SHORT="${GITHUB_SHA::7}"
COMMIT_TAGS+=("pr-${{ github.event.number }}-${MAJOR_VERSION}")
COMMIT_TAGS+=("${SHA_SHORT}-${MAJOR_VERSION}")
COMMIT_TAGS+=("pr-${{ github.event.number }}-${MAJOR_VERSION}${PLATFORM_TAG}")
COMMIT_TAGS+=("${SHA_SHORT}-${MAJOR_VERSION}${PLATFORM_TAG}")
if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[[ "${{ matrix.is_stable_version }}" == "true" ]]; then
COMMIT_TAGS+=("pr-${{ github.event.number }}")
COMMIT_TAGS+=("${SHA_SHORT}")
COMMIT_TAGS+=("pr-${{ github.event.number }}${PLAFTORM_TAG}")
COMMIT_TAGS+=("${SHA_SHORT}${PLAFTORM_TAG}")
fi

BUILD_TAGS=("${MAJOR_VERSION}" "${MAJOR_VERSION}-${TIMESTAMP}")
BUILD_TAGS=("${MAJOR_VERSION}${PLAFTORM_TAG}" "${MAJOR_VERSION}-${TIMESTAMP}${PLAFTORM_TAG}")

if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[[ "${{ matrix.is_stable_version }}" == "true" ]]; then
BUILD_TAGS+=("latest")
BUILD_TAGS+=("${TIMESTAMP}${PLAFTORM_TAG}")
BUILD_TAGS+=("latest${PLAFTORM_TAG}")
fi

if [[ "${{ github.event_name }}" == "pull_request" ]]; then
Expand Down Expand Up @@ -123,6 +143,9 @@ jobs:
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/ublue-os/main/main/README.md
io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/120078124?s=200&v=4

- name: Set architecture env
run: echo "ARCHITECTURE=${PLATFORM/"linux/"/""}" >> $GITHUB_ENV

# Build image using Buildah action
- name: Build Image
id: build_image
Expand All @@ -137,8 +160,11 @@ jobs:
IMAGE_NAME=${{ matrix.image_name }}
SOURCE_IMAGE=${{ env.SOURCE_IMAGE }}
FEDORA_MAJOR_VERSION=${{ matrix.major_version }}
ARCHITECTURE=${{ env.ARCHITECTURE }}
labels: ${{ steps.meta.outputs.labels }}
platform: ${{ matrix.platform }}
oci: false


# 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
Expand Down
6 changes: 4 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
ARG IMAGE_NAME="${IMAGE_NAME:-silverblue}"
ARG SOURCE_IMAGE="${SOURCE_IMAGE:-silverblue}"
ARG BASE_IMAGE="quay.io/fedora-ostree-desktops/${SOURCE_IMAGE}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-37}"
ARG ARCHITECTURE="${ARCHITECTURE:-x86_64}"
ARG BASE_IMAGE="ghcr.io/stable-os/fedora-ostree-desktop-${SOURCE_IMAGE}:latest-${FEDORA_MAJOR_VERSION}-${ARCHITECTURE}"

FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS builder
FROM silverblue:latest-39-arm64
FROM ${BASE_IMAGE} AS builder

ARG IMAGE_NAME="${IMAGE_NAME}"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}"
Expand Down
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

uname -m

set -ouex pipefail

RELEASE="$(rpm -E %fedora)"
Expand Down