[enh] container: support multiple registries
Allows to push the manifests to other registries, this allows to push both docker.io and ghcr.io registries.
This commit is contained in:
parent
da3c640cef
commit
d2bb7cdb96
17
.github/workflows/container.yml
vendored
17
.github/workflows/container.yml
vendored
@ -117,10 +117,6 @@ jobs:
|
|||||||
os: ubuntu-24.04-arm
|
os: ubuntu-24.04-arm
|
||||||
emulation: true
|
emulation: true
|
||||||
|
|
||||||
permissions:
|
|
||||||
# Organization GHCR
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -152,15 +148,17 @@ jobs:
|
|||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
# Organization GHCR
|
||||||
|
packages: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- if: env.DOCKERHUB_USERNAME != null
|
- name: Checkout
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: "false"
|
persist-credentials: "false"
|
||||||
|
|
||||||
- if: env.DOCKERHUB_USERNAME != null
|
- name: Login to GHCR
|
||||||
name: Login to GHCR
|
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: "ghcr.io"
|
registry: "ghcr.io"
|
||||||
@ -175,8 +173,7 @@ jobs:
|
|||||||
username: "${{ env.DOCKERHUB_USERNAME }}"
|
username: "${{ env.DOCKERHUB_USERNAME }}"
|
||||||
password: "${{ secrets.DOCKERHUB_TOKEN }}"
|
password: "${{ secrets.DOCKERHUB_TOKEN }}"
|
||||||
|
|
||||||
- if: env.DOCKERHUB_USERNAME != null
|
- name: Release
|
||||||
name: Release
|
|
||||||
env:
|
env:
|
||||||
GIT_URL: "${{ needs.build.outputs.git_url }}"
|
GIT_URL: "${{ needs.build.outputs.git_url }}"
|
||||||
DOCKER_TAG: "${{ needs.build.outputs.docker_tag }}"
|
DOCKER_TAG: "${{ needs.build.outputs.docker_tag }}"
|
||||||
|
@ -272,8 +272,7 @@ container.push() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Manifest tags
|
# Manifest tags
|
||||||
release_tags=("latest")
|
release_tags=("latest" "$DOCKER_TAG")
|
||||||
release_tags+=("$DOCKER_TAG")
|
|
||||||
|
|
||||||
# Create manifests
|
# Create manifests
|
||||||
for tag in "${release_tags[@]}"; do
|
for tag in "${release_tags[@]}"; do
|
||||||
@ -291,13 +290,18 @@ container.push() {
|
|||||||
|
|
||||||
podman image list
|
podman image list
|
||||||
|
|
||||||
# Push manifests
|
# Remote registries
|
||||||
for tag in "${release_tags[@]}"; do
|
release_registries=("ghcr.io" "docker.io")
|
||||||
build_msg CONTAINER "Pushing manifest with tag: $tag"
|
|
||||||
|
|
||||||
podman manifest push \
|
# Push manifests
|
||||||
"localhost/$CONTAINER_IMAGE_ORGANIZATION/$CONTAINER_IMAGE_NAME:$tag" \
|
for registry in "${release_registries[@]}"; do
|
||||||
"docker://docker.io/$CONTAINER_IMAGE_ORGANIZATION/$CONTAINER_IMAGE_NAME:$tag"
|
for tag in "${release_tags[@]}"; do
|
||||||
|
build_msg CONTAINER "Pushing manifest $tag to $registry"
|
||||||
|
|
||||||
|
podman manifest push \
|
||||||
|
"localhost/$CONTAINER_IMAGE_ORGANIZATION/$CONTAINER_IMAGE_NAME:$tag" \
|
||||||
|
"docker://$registry/$CONTAINER_IMAGE_ORGANIZATION/$CONTAINER_IMAGE_NAME:$tag"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
dump_return $?
|
dump_return $?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user