2023-08-26 02:06:51 -07:00
name : Build Bazzite
2023-02-09 11:08:39 -08:00
on :
2023-06-18 19:22:17 +00:00
schedule :
2023-10-31 21:49:11 -06:00
- cron : '40 16 * * 2,5' # 16:40 utc tues thurs
2023-02-09 11:08:39 -08:00
pull_request :
branches :
- main
2023-11-20 09:54:13 -07:00
- testing
- unstable
2023-06-18 19:22:17 +00:00
paths-ignore :
- '**.md'
- '**.txt'
2023-07-25 23:05:25 -07:00
- 'repo_content/**'
- 'spec_files/**'
2023-09-21 22:53:20 -07:00
- 'post_install_files/**'
2024-01-19 16:49:40 -08:00
- 'press_kit/**'
2023-02-09 11:08:39 -08:00
push :
branches :
- main
2023-11-01 12:25:24 -06:00
- testing
- unstable
2023-06-18 19:22:17 +00:00
paths-ignore :
- '**.md'
- '**.txt'
2023-07-25 23:05:25 -07:00
- 'repo_content/**'
- 'spec_files/**'
2023-09-21 22:53:20 -07:00
- 'post_install_files/**'
2024-01-19 16:49:40 -08:00
- 'press_kit/**'
2023-06-18 19:22:17 +00:00
merge_group :
workflow_dispatch :
2023-02-09 11:08:39 -08:00
env :
2023-11-01 12:25:24 -06:00
IMAGE_REGISTRY : ghcr.io/${{ github.repository_owner }}
2023-02-09 11:08:39 -08:00
2023-11-05 08:31:41 -08:00
concurrency :
group : ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress : true
2023-02-09 11:08:39 -08:00
jobs :
push-ghcr :
2023-09-28 17:27:53 -07:00
name : Make
2023-08-15 19:49:48 -07:00
runs-on : ubuntu-22.04
2023-02-09 11:08:39 -08:00
permissions :
contents : read
packages : write
id-token : write
strategy :
fail-fast : false
matrix :
2023-11-30 08:48:31 -07:00
base_image_flavor : [ main, asus, framework, surface]
base_name : [ bazzite, bazzite-deck, bazzite-nvidia]
2023-08-01 19:07:29 -06:00
base_image_name : [ kinoite, silverblue]
2023-11-06 21:20:48 -08:00
major_version : [ 39 ]
2023-02-09 11:08:39 -08:00
include :
2023-10-16 21:46:52 +03:00
- major_version : 39
2023-10-13 14:35:10 -06:00
is_latest_version : true
2023-06-18 19:22:17 +00:00
is_stable_version : true
2023-08-09 21:10:23 -06:00
exclude :
- base_name : bazzite-deck
2023-11-30 08:48:31 -07:00
base_image_flavor : nvidia
2023-09-29 11:31:22 -06:00
- base_name : bazzite-deck
2023-11-30 08:48:31 -07:00
base_image_flavor : asus-nvidia
2023-09-28 20:29:19 -06:00
- base_name : bazzite-deck
2023-11-30 08:48:31 -07:00
base_image_flavor : surface
2023-09-29 11:31:22 -06:00
- base_name : bazzite-deck
2023-11-30 08:48:31 -07:00
base_image_flavor : surface-nvidia
- base_name : bazzite-nvidia
base_image_flavor : framework
2023-05-23 13:11:45 -06:00
steps :
2023-12-18 20:57:08 -07:00
- name : Verify base image
2023-12-24 07:46:02 -07:00
uses : EyeCantCU/cosign-action/verify@v0.2.0
2023-12-18 20:57:08 -07:00
with :
2023-12-24 07:46:02 -07:00
containers : ${{ matrix.base_image_name }}-${{ matrix.base_image_flavor }}
pubkey : https://raw.githubusercontent.com/ublue-os/${{ matrix.base_image_flavor }}/main/cosign.pub
2023-12-18 20:57:08 -07:00
2023-02-09 11:08:39 -08:00
# Checkout push-to-registry action GitHub repository
- name : Checkout Push to Registry action
2023-09-11 11:17:20 +00:00
uses : actions/checkout@v4
2023-02-09 11:08:39 -08:00
2023-11-20 13:43:07 +00:00
- name : Check just syntax
uses : ublue-os/just-action@v1
2023-12-18 21:12:51 -07:00
- name : Maximize build space
uses : ublue-os/remove-unwanted-software@v6
2023-06-18 19:22:17 +00:00
- name : Matrix Variables
run : |
2023-11-30 08:48:31 -07:00
echo "AKMODS_FLAVOR=fsync" >> $GITHUB_ENV
2023-08-01 19:07:29 -06:00
echo "BASE_IMAGE_NAME=${{ matrix.base_image_name }}" >> $GITHUB_ENV
2023-11-30 08:48:31 -07:00
2023-11-30 17:48:19 -07:00
if [[ "${{ matrix.base_image_flavor }}" == "framework" ]]; then
echo "BASE_IMAGE_FLAVOR=framework" >> $GITHUB_ENV
else
echo "BASE_IMAGE_FLAVOR=main" >> $GITHUB_ENV
fi
2023-11-30 08:48:31 -07:00
if [[ "${{ matrix.base_name }}" == "bazzite-nvidia" ]]; then
if [[ "${{ matrix.base_image_flavor }}" == "main" ]]; then
echo "IMAGE_FLAVOR=nvidia" >> $GITHUB_ENV
else
echo "IMAGE_FLAVOR=${{ format('{0}-{1}', matrix.base_image_flavor, 'nvidia') }}" >> $GITHUB_ENV
fi
else
echo "IMAGE_FLAVOR=${{ matrix.base_image_flavor }}" >> $GITHUB_ENV
fi
- name : Set image name
run : |
2023-11-30 18:36:32 -07:00
DESKTOP=""
if [[ "${{ matrix.base_image_name }}" == "silverblue" ]]; then
DESKTOP="-gnome"
fi
2023-09-28 20:29:19 -06:00
if [[ "${{ matrix.base_name }}" == "bazzite-deck" ]]; then
2023-11-30 08:48:31 -07:00
if [[ "${{ matrix.base_image_flavor }}" == "asus" ]]; then
2023-09-28 20:29:19 -06:00
echo "IMAGE_NAME=${{ format('{0}{1}', 'bazzite-ally', '${DESKTOP}') }}" >> $GITHUB_ENV
2023-11-30 08:48:31 -07:00
elif [[ "${{ matrix.base_image_flavor }}" == "framework" ]]; then
2023-09-28 20:29:19 -06:00
echo "IMAGE_NAME=${{ format('{0}{1}', 'bazzite-framegame', '${DESKTOP}') }}" >> $GITHUB_ENV
2023-08-01 19:07:29 -06:00
else
2023-09-28 20:29:19 -06:00
echo "IMAGE_NAME=${{ format('{0}{1}', 'bazzite-deck', '${DESKTOP}') }}" >> $GITHUB_ENV
2023-08-01 19:07:29 -06:00
fi
2023-06-18 19:22:17 +00:00
else
2023-11-30 08:48:31 -07:00
if [[ "${{ env.IMAGE_FLAVOR }}" == "main" ]]; then
echo "IMAGE_NAME=${{ format('{0}{1}', 'bazzite', '${DESKTOP}') }}" >> $GITHUB_ENV
2023-08-01 19:07:29 -06:00
else
2023-11-30 08:48:31 -07:00
echo "IMAGE_NAME=${{ format('{0}{1}-{2}', 'bazzite', '${DESKTOP}', env.IMAGE_FLAVOR) }}" >> $GITHUB_ENV
2023-08-01 19:07:29 -06:00
fi
2023-06-18 19:22:17 +00:00
fi
- name : Generate tags
id : generate-tags
shell : bash
run : |
# 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}"
2023-08-13 22:17:03 -06:00
COMMIT_TAGS+=("pr-${{ github.event.pull_request.number }}-${MAJOR_VERSION}")
2023-06-18 19:22:17 +00:00
COMMIT_TAGS+=("${SHA_SHORT}-${MAJOR_VERSION}")
if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[ [ "${{ matrix.is_stable_version }}" == "true" ]]; then
2023-08-16 15:17:13 -06:00
COMMIT_TAGS+=("pr-${{ github.event.pull_request.number }}")
2023-06-18 19:22:17 +00:00
COMMIT_TAGS+=("${SHA_SHORT}")
fi
2023-11-01 12:25:24 -06:00
if [[ ${{ github.ref_name }} == "unstable" ]]; then
BUILD_TAGS=("${MAJOR_VERSION}-unstable" "${MAJOR_VERSION}-unstable-${TIMESTAMP}")
if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[ [ "${{ matrix.is_stable_version }}" == "true" ]]; then
BUILD_TAGS+=("unstable")
fi
elif [[ ${{ github.ref_name }} == "testing" ]]; then
BUILD_TAGS=("${MAJOR_VERSION}-testing" "${MAJOR_VERSION}-testing-${TIMESTAMP}")
if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[ [ "${{ matrix.is_stable_version }}" == "true" ]]; then
BUILD_TAGS+=("testing")
fi
else
BUILD_TAGS=("${MAJOR_VERSION}" "${MAJOR_VERSION}-${TIMESTAMP}")
if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[ [ "${{ matrix.is_stable_version }}" == "true" ]]; then
BUILD_TAGS+=("latest")
fi
2023-06-18 19:22:17 +00:00
fi
2023-08-29 08:31:51 -06:00
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
2023-06-18 19:22:17 +00:00
echo "Generated the following commit tags: "
for TAG in "${COMMIT_TAGS[@]}"; do
echo "${TAG}"
done
alias_tags=("${COMMIT_TAGS[@]}")
else
alias_tags=("${BUILD_TAGS[@]}")
fi
echo "Generated the following build tags: "
for TAG in "${BUILD_TAGS[@]}"; do
echo "${TAG}"
done
echo "alias_tags=${alias_tags[*]}" >> $GITHUB_OUTPUT
- name : Get Current Fedora Version
2023-03-30 05:18:47 +00:00
id : labels
run : |
2023-11-30 08:48:31 -07:00
if [[ "${{ matrix.base_name }}" == "bazzite-nvidia" ]]; then
ver=$(skopeo inspect docker://ghcr.io/ublue-os/bazzite-${{ env.IMAGE_FLAVOR }}:${{ matrix.major_version }} | jq -r '.Labels["org.opencontainers.image.version"]')
elif [[ "${{ env.IMAGE_FLAVOR}}" == "main" ]]; then
ver=$(skopeo inspect docker://ghcr.io/ublue-os/${{ matrix.base_image_name }}:${{ matrix.major_version }} | jq -r '.Labels["org.opencontainers.image.version"]')
else
ver=$(skopeo inspect docker://ghcr.io/ublue-os/${{ matrix.base_image_name }}-${{ env.IMAGE_FLAVOR }}:${{ matrix.major_version }} | jq -r '.Labels["org.opencontainers.image.version"]')
fi
2023-03-30 05:18:47 +00:00
echo "VERSION=$ver" >> $GITHUB_OUTPUT
2023-02-15 13:48:36 -08:00
# Build metadata
- name : Image Metadata
2023-09-18 11:54:29 +00:00
uses : docker/metadata-action@v5
2023-02-15 13:48:36 -08:00
id : meta
with :
images : |
2023-06-18 19:22:17 +00:00
${{ env.IMAGE_NAME }}
2023-02-15 13:48:36 -08:00
labels : |
2023-06-18 19:22:17 +00:00
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
2023-03-30 05:18:47 +00:00
org.opencontainers.image.version=${{ steps.labels.outputs.VERSION }}
2023-09-22 17:10:52 -07:00
org.opencontainers.image.description=Bazzite is an OCI image that serves as an alternative operating system for the Steam Deck, and a ready-to-game SteamOS-like for desktop computers, living room home theater PCs, and numerous other handheld PCs.
io.artifacthub.package.readme-url=https://bazzite.gg/
2023-07-18 00:19:12 -07:00
io.artifacthub.package.logo-url=https://raw.githubusercontent.com/ublue-os/bazzite/main/repo_content/logo.png
2023-02-09 11:08:39 -08:00
# Build image using Buildah action
- name : Build Image
id : build_image
uses : redhat-actions/buildah-build@v2
with :
containerfiles : |
2023-06-18 19:22:17 +00:00
./Containerfile
image : ${{ env.IMAGE_NAME }}
2023-02-09 11:08:39 -08:00
tags : |
${{ steps.generate-tags.outputs.alias_tags }}
build-args : |
2023-06-18 19:22:17 +00:00
IMAGE_NAME=${{ env.IMAGE_NAME }}
2023-11-30 08:48:31 -07:00
IMAGE_FLAVOR=${{ env.IMAGE_FLAVOR }}
2023-10-20 19:01:52 +02:00
IMAGE_VENDOR=${{ github.repository_owner }}
2023-08-01 19:07:29 -06:00
BASE_IMAGE_NAME=${{ matrix.base_image_name }}
2023-11-30 17:48:19 -07:00
BASE_IMAGE_FLAVOR=${{ env.BASE_IMAGE_FLAVOR }}
2023-02-09 11:08:39 -08:00
FEDORA_MAJOR_VERSION=${{ matrix.major_version }}
2023-10-13 14:35:10 -06:00
AKMODS_FLAVOR=${{ env.AKMODS_FLAVOR }}
2024-01-05 17:59:55 -08:00
IMAGE_BRANCH=${{ github.ref_name }}
2023-02-15 13:48:36 -08:00
labels : ${{ steps.meta.outputs.labels }}
oci : false
2023-06-18 19:22:17 +00:00
extra-args : |
--target=${{ matrix.base_name }}
2023-02-09 11:08:39 -08:00
2024-01-04 06:54:01 -07:00
- name : Sign kernel
2024-01-11 13:38:20 -07:00
uses : EyeCantCU/kernel-signer@v0.1.2
2024-01-04 06:54:01 -07:00
with :
image : ${{ steps.build_image.outputs.image }}
privkey : ${{ secrets.AKMOD_PRIVKEY_20230518 }}
pubkey : /etc/pki/akmods/certs/akmods-ublue.der
tags : ${{ steps.build_image.outputs.tags }}
2023-02-09 11:08:39 -08:00
# 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
2023-10-30 12:30:50 -07:00
uses : ASzc/change-string-case-action@v6
2023-02-09 11:08:39 -08:00
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
2023-08-29 08:31:51 -06:00
if : github.event_name != 'pull_request'
2023-02-09 11:08:39 -08:00
env :
REGISTRY_USER : ${{ github.actor }}
REGISTRY_PASSWORD : ${{ github.token }}
with :
image : ${{ steps.build_image.outputs.image }}
tags : ${{ steps.build_image.outputs.tags }}
registry : ${{ steps.registry_case.outputs.lowercase }}
username : ${{ env.REGISTRY_USER }}
password : ${{ env.REGISTRY_PASSWORD }}
extra-args : |
--disable-content-trust
2023-06-18 19:22:17 +00:00
2023-03-04 16:45:59 -08:00
- name : Sign container image
2023-12-24 07:46:02 -07:00
uses : EyeCantCU/cosign-action/sign@v0.2.0
2023-08-29 08:31:51 -06:00
if : github.event_name != 'pull_request'
2023-12-18 21:06:05 -07:00
with :
2023-12-24 07:46:02 -07:00
containers : ${{ env.IMAGE_NAME }}
2023-12-18 21:06:05 -07:00
registry-token : ${{ secrets.GITHUB_TOKEN }}
signing-secret : ${{ secrets.SIGNING_SECRET }}
tags : ${{ steps.push.outputs.digest }}
2023-02-09 11:08:39 -08:00
- name : Echo outputs
2023-08-29 08:31:51 -06:00
if : github.event_name != 'pull_request'
2023-02-09 11:08:39 -08:00
run : |
2023-03-30 05:18:47 +00:00
echo "${{ toJSON(steps.push.outputs) }}"