-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (72 loc) · 2.94 KB
/
build-deploy.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
name: build-deploy-bay-images
run-name: Build and deploy Bay images
on:
pull_request:
types:
- closed
- opened
- synchronize
schedule:
- cron: '23 20 * * 0'
workflow_dispatch:
env:
REGISTRY: ghcr.io
jobs:
buildx:
if: github.event.pull_request.merged == true || contains(fromJson('["schedule", "workflow_dispatch"]'), github.event_name) || github.event_name == 'pull_request' && startsWith(github.head_ref,'build/')
runs-on: ubuntu-latest
strategy:
matrix:
images: ${{ fromJson(vars.IMAGES) }}
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: actions/checkout@v3
- name: Login to registry ${{ env.REGISTRY }}
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: |
${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.images }}
tags: |
type=ref,event=pr,enable=${{ github.event.pull_request.merged == false }}
type=raw,value=${{ github.event.pull_request.base.ref }},enable=${{ github.event.pull_request.merged == true }}
type=ref,event=branch,enable=${{ contains(fromJson('["schedule", "workflow_dispatch"]'), github.event_name) }}
labels: |
maintainer=Digital Victoria
repository=${{ github.repositoryUrl }}
org.opencontainers.image.authors=Digital Victoria
org.opencontainers.image.source=https://github.com/${{ github.repository }}/tree/${{ (contains(fromJson('["opened","synchronize"]'), github.event.action)) && github.head_ref || github.event.action == 'closed' && github.base_ref || github.ref_name }}/images/${{ matrix.images }}/Dockerfile
org.opencontainers.image.title=${{ matrix.images }}
org.opencontainers.image.description=${{ matrix.images }} image for Bay container platform
- name: Build and push the images
uses: docker/[email protected]
with:
push: true
files: |
./gh-actions-bake.hcl
${{ steps.meta.outputs.bake-file }}
# Target the default group - probably unnecessary.
targets: ${{ matrix.images }}
- name: Build and push AWX-EE
run: |
pip install --upgrade ansible-builder
cd images/awx-ee
ansible-builder build \
--file execution-environment.yml \
--build-arg PYCMD="/usr/local/bin/python3" \
--build-arg PKGMGR="/usr/bin/apt-get" \
--verbosity 3
- name: Build and push the images
uses: docker/bake-action@v4
with:
push: true
workdir: ./images/awx-ee