generated from ublue-os/image-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
772b56d
commit 180c716
Showing
1 changed file
with
57 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,17 +5,19 @@ on: | |
branches: | ||
- main | ||
schedule: | ||
- cron: '05 10 * * 1' | ||
- cron: '05 10 * * *' # 10:05am UTC everyday | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- '**/README.md' | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}-iso | ||
cancel-in-progress: true | ||
|
||
env: | ||
MY_IMAGE_NAME: "${{ github.event.repository.name }}" # the name of the image produced by this build, matches repo names | ||
MY_IMAGE_DESC: "A custom image designed for school and work environments" | ||
|
@@ -31,35 +33,53 @@ jobs: | |
packages: write | ||
id-token: write | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
steps: | ||
# Checkout push-to-registry action GitHub repository | ||
- name: Checkout Push to Registry action | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set Image Tag | ||
id: generate-tag | ||
- name: Generate tags | ||
id: generate-tags | ||
shell: bash | ||
run: | | ||
if [[ "${{ env.IS_LATEST_VERSION }}" == "true" ]]; then | ||
TAG="latest" | ||
elif [[ "${{ env.IS_GTS_VERSION }}" == "true" ]]; then | ||
TAG="gts" | ||
fi | ||
if [[ "${{ github.ref_name }}" == "testing" ]]; then | ||
if [[ "${{ env.IS_GTS_VERSION }}" == "true" ]]; then | ||
TAG="gts-testing" | ||
elif [[ "${{ env.IS_LATEST_VERSION }}" == "true" ]]; then | ||
TAG="testing" | ||
fi | ||
# Generate a timestamp for creating an image version history | ||
TIMESTAMP="$(date +%Y%m%d)" | ||
COMMIT_TAGS=() | ||
BUILD_TAGS=() | ||
# Have tags for tracking builds during pull request | ||
SHA_SHORT="${GITHUB_SHA::7}" | ||
COMMIT_TAGS+=("pr-${{ github.event.number }}") | ||
COMMIT_TAGS+=("${SHA_SHORT}") | ||
# Append matching timestamp tags to keep a version history | ||
for TAG in "${BUILD_TAGS[@]}"; do | ||
BUILD_TAGS+=("${TAG}-${TIMESTAMP}") | ||
done | ||
BUILD_TAGS+=("${TIMESTAMP}") | ||
BUILD_TAGS+=("latest") | ||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | ||
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 | ||
# 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.fedora_version }}" | ||
#fi | ||
echo "Generated the following build tags: " | ||
for TAG in "${BUILD_TAGS[@]}"; do | ||
echo "${TAG}" | ||
done | ||
echo "tag=${TAG}" >> $GITHUB_OUTPUT | ||
echo "alias_tags=${alias_tags[*]}" >> $GITHUB_OUTPUT | ||
# Build metadata | ||
- name: Image Metadata | ||
|
@@ -137,19 +157,30 @@ jobs: | |
COSIGN_EXPERIMENTAL: false | ||
COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }} | ||
|
||
- name: Build ISOs | ||
- 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: Build ISO | ||
uses: jasonn3/[email protected] | ||
id: build | ||
with: | ||
arch: x86_64 | ||
image_name: ${{ env.IMAGE_NAME }} | ||
image_name: ${{ matrix.image_name }} | ||
image_repo: ghcr.io/projm-dev-team | ||
image_tag: ${{ steps.generate-tag.outputs.tag }} | ||
image_tag: ${{ steps.build_image.outputs.tags }} | ||
secure_boot_key_url: 'https://github.com/ublue-os/akmods/raw/main/certs/public_key.der' | ||
enrollment_password: 'ublue-os' | ||
iso_name: ${{ env.IMAGE_NAME }}-${{ steps.generate-tag.outputs.tag }}.iso | ||
iso_name: edublue-${{ steps.build_image.outputs.tags }}.iso | ||
enable_cache_dnf: "false" | ||
enable_cache_skopeo: "false" | ||
extra_boot_params: ${{ steps.generate-extra-params.outputs.extra-boot-params }} | ||
|
||
- name: Move ISOs to Upload Directory | ||
id: upload-directory | ||
|
@@ -166,7 +197,7 @@ jobs: | |
#if: github.event_name == 'pull_request' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ steps.build.outputs.iso_name }} | ||
name: edublue-${{ steps.build_image.outputs.tags }} | ||
path: ${{ steps.upload-directory.outputs.iso-upload-dir }} | ||
if-no-files-found: error | ||
retention-days: 0 | ||
|