-
Notifications
You must be signed in to change notification settings - Fork 42
89 lines (85 loc) · 2.66 KB
/
push_docker_image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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