generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 11
49 lines (40 loc) · 1.37 KB
/
build-n-push.yaml
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
name: BuildnPush
on:
workflow_call:
inputs:
IMAGE_REGISTRY:
required: true
type: string
outputs:
IMAGE_PATH:
description: "Image Path"
value: ${{ jobs.image-build-n-push.outputs.IMAGE_PATH }}
jobs:
unit-tests:
uses: ./.github/workflows/unit-tests.yaml
image-build-n-push:
needs: [unit-tests]
runs-on: ubuntu-latest
name: Builds container image and pushes to registry
env:
IMAGE_REGISTRY: ${{ inputs.IMAGE_REGISTRY }}
outputs:
IMAGE_PATH: ${{ steps.print-docker-image-path.outputs.IMAGE_PATH }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: amd64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log into GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${GITHUB_ACTOR,,} --password-stdin
- name: Build Image
run: IMAGE_REGISTRY="${{ env.IMAGE_REGISTRY }}" make docker-build
- name: Push Image
run: IMAGE_REGISTRY="${{ env.IMAGE_REGISTRY }}" make docker-push
- name: Print Image Path
id: print-docker-image-path
run: echo IMAGE_PATH=`IMAGE_REGISTRY="${{ env.IMAGE_REGISTRY }}" make print-docker-image-path` >> $GITHUB_OUTPUT