Use Buildah for registry publishing
This commit is contained in:
@@ -40,30 +40,16 @@ jobs:
|
||||
- name: Login to Gitea Registry
|
||||
env:
|
||||
REGISTRY_HOST: ${{ vars.REGISTRY_HOST }}
|
||||
REGISTRY_PUSH_HOST: ${{ vars.REGISTRY_PUSH_HOST }}
|
||||
REGISTRY_INSECURE: ${{ vars.REGISTRY_INSECURE }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: |
|
||||
push_host="${REGISTRY_PUSH_HOST:-${REGISTRY_HOST}}"
|
||||
tls_verify=true
|
||||
if [ "${REGISTRY_INSECURE}" = "true" ]; then
|
||||
tls_verify=false
|
||||
fi
|
||||
printf '%s' "${REGISTRY_PASSWORD}" | buildah login --tls-verify="${tls_verify}" -u "${GITHUB_REPOSITORY_OWNER}" --password-stdin "${push_host}"
|
||||
printf '%s' "${REGISTRY_PASSWORD}" | buildah login --tls-verify=false -u "${GITHUB_REPOSITORY_OWNER}" --password-stdin "${REGISTRY_HOST}"
|
||||
|
||||
- name: Build and Push Image
|
||||
env:
|
||||
REGISTRY_HOST: ${{ vars.REGISTRY_HOST }}
|
||||
REGISTRY_PUSH_HOST: ${{ vars.REGISTRY_PUSH_HOST }}
|
||||
REGISTRY_INSECURE: ${{ vars.REGISTRY_INSECURE }}
|
||||
run: |
|
||||
push_host="${REGISTRY_PUSH_HOST:-${REGISTRY_HOST}}"
|
||||
tls_verify=true
|
||||
if [ "${REGISTRY_INSECURE}" = "true" ]; then
|
||||
tls_verify=false
|
||||
fi
|
||||
export BUILDAH_ISOLATION=chroot
|
||||
image="${push_host}/${GITHUB_REPOSITORY}"
|
||||
image="${REGISTRY_HOST}/${GITHUB_REPOSITORY}"
|
||||
buildah bud --storage-driver=vfs --format docker -t "${image}:main" -t "${image}:sha-${GITHUB_SHA}" .
|
||||
buildah push --tls-verify="${tls_verify}" "${image}:main"
|
||||
buildah push --tls-verify="${tls_verify}" "${image}:sha-${GITHUB_SHA}"
|
||||
buildah push --tls-verify=false "${image}:main"
|
||||
buildah push --tls-verify=false "${image}:sha-${GITHUB_SHA}"
|
||||
|
||||
Reference in New Issue
Block a user