Skip to content

Retag private docker images. #97

Retag private docker images.

Retag private docker images. #97

name: Build Docker environment container
on:
workflow_dispatch:
push:
tags:
- "android*"
- "base*"
- "linux*"
- "emsdk*"
- "wine*"
- "winsdk*"
- "nssdk*"
- "ps4*"
- "ps5*"
env:
GOOGLE_ARTIFACT_REGISTRY: europe-west1-docker.pkg.dev
PUBLIC_REGISTRY: europe-west1-docker.pkg.dev/extender-426409/extender-public-registry
PRIVATE_REGISTRY_PS4: europe-west1-docker.pkg.dev/extender-426409/extender-ps4-private-registry
PRIVATE_REGISTRY_PS5: europe-west1-docker.pkg.dev/extender-426409/extender-ps5-private-registry
PRIVATE_REGISTRY_NINTENDO: europe-west1-docker.pkg.dev/extender-426409/extender-nintendo-private-registry
PRIVATE_PLATFORMS: "nssdk ps4 ps5"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Process tag name
id: name_postprocess
run: |
PRIVATE_PLATFORM_LIST="${{ env.PRIVATE_PLATFORMS }}"
PUBLIC_REGISTRY="${{ env.PUBLIC_REGISTRY }}"
PRIVATE_REGISTRY_PS4="${{ env.PRIVATE_REGISTRY_PS4 }}"
PRIVATE_REGISTRY_PS5="${{ env.PRIVATE_REGISTRY_PS5 }}"
PRIVATE_REGISTRY_NINTENDO="${{ env.PRIVATE_REGISTRY_NINTENDO }}"
SHORT_SHA="$(echo ${GITHUB_SHA} | cut -c1-8)"
TAG_NAME=${{ github.ref_name }}
DOCKERFILE="${TAG_NAME%%-*}"
PLATFORM="${DOCKERFILE%%.*}"
PLATFORM_VERSION=$(if [[ "$DOCKERFILE" == *"."* ]]; then echo "${DOCKERFILE#*.}"; else echo ""; fi)
IMAGE_VERSION="${TAG_NAME#*-}"
IMAGE_NAME=$(if [[ "$PLATFORM_VERSION" != "" ]]; then echo "$PLATFORM-$PLATFORM_VERSION"; else echo "$PLATFORM"; fi)
if [[ $PRIVATE_PLATFORM_LIST == *$PLATFORM* ]]; then
case $PLATFORM in
ps4)
TARGET_REGISTRY=$(echo $PRIVATE_REGISTRY_PS4)
;;
ps5)
TARGET_REGISTRY=$(echo $PRIVATE_REGISTRY_PS5)
;;
nssdk)
TARGET_REGISTRY=$(echo $PRIVATE_REGISTRY_NINTENDO)
;;
esac
else
TARGET_REGISTRY=$(echo $PUBLIC_REGISTRY)
fi
echo "TAG_NAME $TAG_NAME"
echo "DOCKERFILE $DOCKERFILE"
echo "PLATFORM $PLATFORM"
echo "PLATFORM_VERSION $PLATFORM_VERSION"
echo "IMAGE_VERSION $IMAGE_VERSION"
echo "IMAGE_NAME $IMAGE_NAME"
echo "TARGET_REGISTRY $TARGET_REGISTRY"
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
echo "dockerfile=$DOCKERFILE" >> $GITHUB_OUTPUT
echo "platform=$PLATFORM" >> $GITHUB_OUTPUT
echo "platform_version=$PLATFORM_VERSION" >> $GITHUB_OUTPUT
echo "image_version=$IMAGE_VERSION" >> $GITHUB_OUTPUT
echo "image_name=$IMAGE_NAME" >> $GITHUB_OUTPUT
echo "target_registry=$TARGET_REGISTRY" >> $GITHUB_OUTPUT
- name: Login to Google Artifact registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.GOOGLE_ARTIFACT_REGISTRY }}
username: _json_key
password: ${{ secrets.DOCKER_REGISTRY_JSON_KEY }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db
- name: Build and push
env:
DM_PACKAGES_URL: ${{ secrets.S3_URL }}
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85
with:
context: ${{ github.workspace }}/server/docker/
file: ${{ github.workspace }}/server/docker/Dockerfile.${{ steps.name_postprocess.outputs.dockerfile }}-env
pull: true
push: true
platforms: |
linux/amd64
secret-envs: |
DM_PACKAGES_URL=DM_PACKAGES_URL
tags: |
${{ steps.name_postprocess.outputs.target_registry }}/extender-${{ steps.name_postprocess.outputs.image_name }}-env:${{ steps.name_postprocess.outputs.image_version }}
${{ steps.name_postprocess.outputs.target_registry }}/extender-${{ steps.name_postprocess.outputs.image_name }}-env:${{ steps.name_postprocess.outputs.short_sha }}
${{ steps.name_postprocess.outputs.target_registry }}/extender-${{ steps.name_postprocess.outputs.image_name }}-env:latest
- name: Notify if tests failed
uses: homoluctus/slatify@master
if: failure()
with:
type: ${{ job.status }}
job_name: 'Extender: Docker environment container'
channel: '#defold-alarms-build'
url: ${{ secrets.SLACK_WEBHOOK }}