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:
parent
cfea662b03
commit
1de35b1511
3 changed files with 39 additions and 10 deletions
34
.github/workflows/build-and-test.yml
vendored
34
.github/workflows/build-and-test.yml
vendored
|
|
@ -39,8 +39,9 @@ jobs:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
fetch-tags: 'true'
|
fetch-tags: 'true'
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta for GHCR
|
||||||
id: meta
|
if: github.event_name != 'pull_request'
|
||||||
|
id: meta_ghcr
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
|
|
@ -51,15 +52,29 @@ jobs:
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
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
|
- name: Buildah Build
|
||||||
id: build-image
|
id: build-image
|
||||||
uses: redhat-actions/buildah-build@v2
|
uses: redhat-actions/buildah-build@v2
|
||||||
with:
|
with:
|
||||||
containerfiles: Containerfile
|
containerfiles: Containerfile
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta_ghcr.outputs.tags || steps.meta_docker.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
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
|
uses: redhat-actions/push-to-registry@v2
|
||||||
with:
|
with:
|
||||||
image: ${{ steps.build-image.outputs.image }}
|
image: ${{ steps.build-image.outputs.image }}
|
||||||
|
|
@ -67,6 +82,15 @@ jobs:
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ github.token }}
|
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:
|
build-and-push-iso:
|
||||||
name: Build ISO
|
name: Build ISO
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
||||||
11
action.yml
11
action.yml
|
|
@ -131,16 +131,19 @@ runs:
|
||||||
ACTION_REF: ${{ github.action_ref }}
|
ACTION_REF: ${{ github.action_ref }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
image="ghcr.io/jasonn3/build-container-installer"
|
||||||
# Check if running inside of the action repo
|
# Check if running inside of the action repo
|
||||||
if [[ -z "${ACTION_REPO}" || "${ACTION_REPO}" == "${{ github.repository }}" ]]
|
if [[ -z "${ACTION_REPO}" || "${ACTION_REPO}" == "${{ github.repository }}" ]]
|
||||||
then
|
then
|
||||||
if [[ "${{ github.ref_name }}" =~ (.*)/merge ]]
|
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
|
else
|
||||||
tag=${{ github.ref_name }}
|
tag="${{ github.ref_name }}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
tag=${ACTION_REF}
|
tag="${ACTION_REF}"
|
||||||
fi
|
fi
|
||||||
if [[ "${{ inputs.enable_cache_dnf }}" == "true" ]]
|
if [[ "${{ inputs.enable_cache_dnf }}" == "true" ]]
|
||||||
then
|
then
|
||||||
|
|
@ -167,7 +170,7 @@ runs:
|
||||||
vars="${vars} FLATPAK_REMOTE_REFS_DIR=\"${{ inputs.flatpak_remote_refs_dir }}\""
|
vars="${vars} FLATPAK_REMOTE_REFS_DIR=\"${{ inputs.flatpak_remote_refs_dir }}\""
|
||||||
fi
|
fi
|
||||||
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 }}" \
|
ADDITIONAL_TEMPLATES="${{ inputs.additional_templates }}" \
|
||||||
ARCH="${{ inputs.arch }}" \
|
ARCH="${{ inputs.arch }}" \
|
||||||
DNF_CACHE="/cache/dnf" \
|
DNF_CACHE="/cache/dnf" \
|
||||||
|
|
|
||||||
|
|
@ -35,3 +35,5 @@ do
|
||||||
result=1
|
result=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
exit ${result}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue