Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Refactor tagging to support multiple image and driver channels #36

Merged
merged 2 commits into from
Feb 15, 2023
Merged
Changes from all commits
Commits
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
76 changes: 58 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,19 @@ jobs:
matrix:
image_name: [silverblue, kinoite, vauxite, sericea, base]
major_version: [37]
driver_version: [525]
driver_version: [520, 525]
include:
# - major_version: 36
# is_latest_version: false
# is_stable_version: true
- major_version: 37
is_latest: true
is_stable: true
is_latest_version: true
is_stable_version: true
# - major_version: 38
# is_latest_version: true
# is_stable_version: false
- driver_version: 525
is_latest: true
is_stable: true
is_latest_driver: true
exclude:
# There is no Fedora 37 version of sericea
# When F38 is added, sericea will automatically be built too
Expand All @@ -52,21 +57,57 @@ jobs:
shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
alias_tags=()
# Only perform the follow code when the action is spawned from a Pull Request

container_tags=()
# The following is run when the timer is triggered or a merge/push to main
TIMESTAMP="$(date +%Y%m%d.%H%M)"

container_tags+=("${{ matrix.major_version }}-${{ matrix.driver_version }}")

if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[[ "${{ matrix.is_stable_version }}" == "true" ]]; then
BRANCH="stable"
elif [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[[ "${{ matrix.is_stable_version }}" != "true" ]]; then
BRANCH="unstable"
else
BRANCH="oldstable"
fi

container_tags+=("${BRANCH}-${{ matrix.driver_version }}")

if [[ "${{ matrix.is_latest_driver }}" == "true" ]]; then
container_tags+=("${{ matrix.major_version }}-current")
container_tags+=("${BRANCH}-current")
container_tags+=("${BRANCH}")
container_tags+=("${{ matrix.major_version }}")
fi

# Append matching timestamp tags to keep a version history
for TAG in "${container_tags[@]}"; do
container_tags+=("${TAG}-${TIMESTAMP}")
container_tags+=("${TAG}-${TIMESTAMP%.*}")
done

if [[ "${BRANCH}" == "stable" ]] && \
[[ "${{ matrix.is_latest_driver }}" == "true" ]]; then
container_tags+=("${TIMESTAMP}")
container_tags+=("${TIMESTAMP%.*}")
container_tags+=("latest")
fi

echo "Generated the following tags: "
for TAG in "${container_tags[@]}"; do
echo "${TAG}"
done

if [[ "${{ github.event_name }}" == "pull_request" ]]; then
alias_tags+=("pr-${{ github.event.number }}")
alias_tags=("pr-${{ github.event.number }}")
else
# The following is run when the timer is triggered or a merge/push to main
echo "date=$(date +%Y%m%d)" >> $GITHUB_OUTPUT
alias_tags+=("${{ matrix.major_version }}")
if [[ "${{ matrix.is_latest }}" == "true" ]]; then
alias_tags+=("latest")
fi
if [[ "${{ matrix.is_stable }}" == "true" ]]; then
alias_tags+=("stable")
fi
alias_tags=("${container_tags[@]}")
fi


echo "alias_tags=${alias_tags[*]}" >> $GITHUB_OUTPUT

- name: Retrieve akmods signing key
Expand Down Expand Up @@ -101,7 +142,6 @@ jobs:
image: ${{ format('{0}-nvidia', matrix.image_name) }}
tags: |
${{ steps.generate-tags.outputs.alias_tags }}
${{ steps.generate-tags.outputs.date }}
${{ steps.generate-tags.outputs.sha_short }}
build-args: |
IMAGE_NAME=${{ matrix.image_name }}
Expand Down