1
0
Fork 0
mirror of https://github.com/JasonN3/build-container-installer.git synced 2025-12-25 10:57:55 +01:00

store pr builds on docker.io

This commit is contained in:
Jason N. 2024-03-15 21:28:33 -04:00
parent cfea662b03
commit 1de35b1511
3 changed files with 39 additions and 10 deletions

View file

@ -39,8 +39,9 @@ jobs:
fetch-depth: 0
fetch-tags: 'true'
- name: Docker meta
id: meta
- name: Docker meta for GHCR
if: github.event_name != 'pull_request'
id: meta_ghcr
uses: docker/metadata-action@v5
with:
images: |
@ -51,15 +52,29 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Docker meta for Docker Hub
if: github.event_name == 'pull_request'
id: meta_docker
uses: docker/metadata-action@v5
with:
images: |
docker.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Buildah Build
id: build-image
uses: redhat-actions/buildah-build@v2
with:
containerfiles: Containerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta_ghcr.outputs.tags || steps.meta_docker.outputs.tags }}
labels: ${{ steps.meta_ghcr.outputs.labels || steps.meta_docker.outputs.labels }}
- name: Push image
- name: Push image to GHCR
if: github.event_name != 'pull_request'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
@ -67,6 +82,15 @@ jobs:
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Push image to Docker
if: github.event_name == 'pull_request'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_TOKEN }}
build-and-push-iso:
name: Build ISO
runs-on: ubuntu-latest

View file

@ -131,16 +131,19 @@ runs:
ACTION_REF: ${{ github.action_ref }}
shell: bash
run: |
image="ghcr.io/jasonn3/build-container-installer"
# Check if running inside of the action repo
if [[ -z "${ACTION_REPO}" || "${ACTION_REPO}" == "${{ github.repository }}" ]]
then
if [[ "${{ github.ref_name }}" =~ (.*)/merge ]]
then tag=pr-${BASH_REMATCH[1]}
then
tag="pr-${BASH_REMATCH[1]}"
image="docker.io/jasonn3/build-container-installer"
else
tag=${{ github.ref_name }}
tag="${{ github.ref_name }}"
fi
else
tag=${ACTION_REF}
tag="${ACTION_REF}"
fi
if [[ "${{ inputs.enable_cache_dnf }}" == "true" ]]
then
@ -167,7 +170,7 @@ runs:
vars="${vars} FLATPAK_REMOTE_REFS_DIR=\"${{ inputs.flatpak_remote_refs_dir }}\""
fi
fi
docker run --privileged --volume ${{ github.workspace }}:/github/workspace/ ${cache} ghcr.io/jasonn3/build-container-installer:${tag} \
docker run --privileged --volume ${{ github.workspace }}:/github/workspace/ ${cache} ${image}:${tag} \
ADDITIONAL_TEMPLATES="${{ inputs.additional_templates }}" \
ARCH="${{ inputs.arch }}" \
DNF_CACHE="/cache/dnf" \

View file

@ -35,3 +35,5 @@ do
result=1
fi
done
exit ${result}