Skip to content

push docker image #3168

push docker image

push docker image #3168

name: push docker image
on:
push:
branches:
- main
- rc-*
- 9c-main
- development
- previewnet
- qa-*
- 2022q3-worldboss
- release/*
# This branch is for testing only. Use until the next(v200080) release.
- test/action-evaluation-publisher-elapse-metric
tags:
- "*"
workflow_dispatch:
inputs:
imageTag:
description: 'Custom docker image tag if needed'
default: ''
jobs:
build_and_push:
name: build_and_push (${{ matrix.docker.repo }})
strategy:
matrix:
docker:
- repo: planetariumhq/ninechronicles-headless
dockerfile: Dockerfile
- repo: planetariumhq/access-control-center
dockerfile: Dockerfile.ACC
if: github.ref_type == 'branch'
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: login
run: |
docker login \
--username '${{ secrets.DOCKER_USERNAME }}' \
--password '${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/arm/v8,linux/amd64
- name: Build and push
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/arm64,linux/amd64
tags: ${{ matrix.docker.repo }}:git-${{ github.sha }}
file: ${{ matrix.docker.dockerfile }}
build-args: COMMIT=git-${{ github.sha }}
env:
BUILDKIT_PROGRESS: 'plain'
tag:
name: tag (${{ matrix.docker.repo }})
strategy:
matrix:
docker:
- repo: planetariumhq/ninechronicles-headless
if: github.ref_type == 'tag' || github.event.inputs.imageTag != ''
runs-on: ubuntu-latest
steps:
- name: login
run: |
docker login \
--username '${{ secrets.DOCKER_USERNAME }}' \
--password '${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}'
- name: push git tagged version
run: |
docker pull ${{ matrix.docker.repo }}:git-${{ github.sha }}
if [[ -z "${{ github.event.inputs.imageTag }}" ]]; then
export IMAGE_TAG=${{ github.ref_name }}
else
export IMAGE_TAG=${{ github.event.inputs.imageTag }}
fi
docker tag \
${{ matrix.docker.repo }}:git-${{ github.sha }} \
${{ matrix.docker.repo }}:$IMAGE_TAG
docker push ${{ matrix.docker.repo }}:$IMAGE_TAG