Adding on home registry

This commit is contained in:
James Jones
2022-12-06 18:49:44 -05:00
parent cdd06f2f1b
commit c065d6f5e9
2 changed files with 17 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ on:
env:
REGISTRY: ghcr.io
NEXUS_REGISTRY: nexus.jamjon3.sytes.net:5443
jobs:
build-and-push:
@@ -23,6 +24,11 @@ jobs:
container:
image: quay.io/podman/stable:latest
options: --userns=keep-id --privileged --user root
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
steps:
# Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code
@@ -36,6 +42,12 @@ jobs:
login-server: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Login
uses: azure/docker-login@v1
with:
login-server: ${{ env.NEXUS_REGISTRY }}
username: ${{ secrets.HOME_NEXUS_DOCKER_USER }}
password: ${{ secrets.HOME_NEXUS_DOCKER_PASSWORD }}
# This requires docker buildx which podman doesn't support
# - name: Extract metadata (tags, labels) for Docker
# id: meta
@@ -58,10 +70,14 @@ jobs:
VERSION=$(echo "${GITHUB_REF_NAME}" | sed 's|/|-|g')
fi
podman build . --file Dockerfile --tag "$REGISTRY/$IMAGE_NAME:$VERSION"
podman tag "$REGISTRY/$IMAGE_NAME:$VERSION" "$NEXUS_REGISTRY/$IMAGE_NAME:$VERSION"
podman push "$REGISTRY/$IMAGE_NAME:$VERSION"
podman push "$NEXUS_REGISTRY/$IMAGE_NAME:$VERSION"
if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then
podman tag "$REGISTRY/$IMAGE_NAME:$VERSION" "$REGISTRY/$IMAGE_NAME:latest"
podman tag "$NEXUS_REGISTRY/$IMAGE_NAME:$VERSION" "$NEXUS_REGISTRY/$IMAGE_NAME:latest"
podman push "$REGISTRY/$IMAGE_NAME:latest"
podman push "$NEXUS_REGISTRY/$IMAGE_NAME:latest"
fi
# env:
# REG_TOKEN: ${{ secrets.GITHUB_TOKEN }}