Skip to content
Open
Show file tree
Hide file tree
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
30 changes: 29 additions & 1 deletion .github/actions/shared-steps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ runs:
echo "CLEAN_ARCH=${ARCH//\//_}" >> "$GITHUB_ENV"

- name: Log in to registry
if: github.event_name != 'pull_request'
shell: bash
run: sudo podman login ${{ inputs.IMAGE_REGISTRY }} -u ${{ inputs.REGISTRY_USER }} -p ${{ inputs.REGISTRY_PASSWORD }}

Expand All @@ -39,6 +40,9 @@ runs:
# 100 - updates available
# 125 - tag/platform not found
# 127 - command not found
if [ "${{ github.event_name }}" != "pull_request" ]; then
exit 100
fi
res=0
sudo podman run ${{ env.VARIANT }} --quiet --rm ${{ inputs.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.VERSION_MAJOR }} dnf check-update || res=$?
echo "res=${res}" >> "$GITHUB_ENV"
Expand Down Expand Up @@ -101,6 +105,21 @@ runs:

echo "image-id=sha256:$(sudo podman image inspect ${{ env.IMAGE_NAME }} -f "{{.Id}}")" >> $GITHUB_OUTPUT

- name: Build Image Tars
id: tars
if: github.event_name == 'pull_request'
shell: bash
env:
IMAGE_ID: ${{ steps.rechunk.outputs.image-id }}
run: |
sudo podman tag \
${{ env.IMAGE_ID }} \
localhost/${{ env.IMAGE_NAME }}:${{ inputs.VERSION_MAJOR }}${{ env.VERSION_MINOR }}-${{ inputs.DATE_STAMP }}-${{ env.CLEAN_ARCH }} && \
sudo podman save \
${{ env.IMAGE_NAME }}:${{ inputs.VERSION_MAJOR }}${{ env.VERSION_MINOR }}-${{ inputs.DATE_STAMP }}-${{ env.CLEAN_ARCH }} > \
/tmp/image-${{ env.IMAGE_NAME }}-${{ inputs.VERSION_MAJOR }}${{ env.VERSION_MINOR }}-${{ inputs.DATE_STAMP }}-${{ env.CLEAN_ARCH }}.tar && \
sudo gzip /tmp/image-${{ env.IMAGE_NAME }}-${{ inputs.VERSION_MAJOR }}${{ env.VERSION_MINOR }}-${{ inputs.DATE_STAMP }}-${{ env.CLEAN_ARCH }}.tar

- name: Run Image
id: run
if: ${{ env.res != 0 || github.event_name == 'workflow_dispatch' }}
Expand All @@ -120,7 +139,7 @@ runs:

- name: Push to registry
id: push
if: ${{ env.res != 0 || github.event_name == 'workflow_dispatch' }}
if: ${{ (env.res != 0 || github.event_name == 'workflow_dispatch') && github.event_name != 'pull_request' }}
env:
IMAGE_ID: ${{ steps.rechunk.outputs.image-id }}
VERSION: ${{ steps.run.outputs.version-id }}
Expand Down Expand Up @@ -154,6 +173,15 @@ runs:

cat /tmp/outputs/digests/${{ env.IMAGE_NAME }}_${{ matrix.VERSION_MAJOR }}_${{ env.CLEAN_ARCH }}.json

- name: Upload Container Image Artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: ${{ github.event_name == 'pull_request' }}
with:
name: image-${{ env.IMAGE_NAME }}-${{ inputs.VERSION_MAJOR }}${{ env.VERSION_MINOR }}-${{ inputs.DATE_STAMP }}-${{ env.CLEAN_ARCH }}.tar.gz
path: /tmp/image-${{ env.IMAGE_NAME }}-${{ inputs.VERSION_MAJOR }}${{ env.VERSION_MINOR }}-${{ inputs.DATE_STAMP }}-${{ env.CLEAN_ARCH }}.tar.gz
retention-days: 1
if-no-files-found: error

- name: Upload Output Artifacts
if: ${{ env.res != 0 || github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Build amd64 and arm64
on:
pull_request:
types: [synchronize, opened, reopened]
workflow_dispatch:
inputs:
RELEASE:
Expand Down Expand Up @@ -36,6 +38,9 @@ jobs:
run: |
# Format json for versions matrix
case ${{ github.event_name }} in
pull_request)
echo "matrix=$(jq -c <<< '[${{ env.VERSIONS_LIST }}]')" >> $GITHUB_OUTPUT
;;
workflow_dispatch)
if [[ "${{ inputs.RELEASE }}" == "ALL" ]]; then
echo "matrix=$(jq -c <<< '[${{ env.VERSIONS_LIST }}]')" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -87,7 +92,7 @@ jobs:
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}

push-manifest:
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
if: ${{ always() && contains(join(needs.*.result, ','), 'success') && github.event_name != 'pull_request' }}
name: Push manifest
needs: [set-versions-matrix, build]
runs-on: ubuntu-24.04
Expand Down