-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (63 loc) · 1.96 KB
/
publish.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Create and publish Docker image
on:
workflow_call:
inputs:
context:
description: 'The Docker build context'
required: true
type: string
registry:
description: 'The Docker registry'
required: true
type: string
image:
description: 'The Docker image name'
required: true
type: string
branch:
description: 'The branch to build'
required: true
type: string
secrets:
NEXUS_DOCKER_PUB_USERNAME:
description: 'Username for the Nexus Docker registry'
required: true
NEXUS_DOCKER_PUB_PASSWORD:
description: 'Password for the Nexus Docker registry'
required: true
jobs:
publish:
runs-on: ubuntu-latest
container: docker:latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ inputs.registry }}
username: ${{ secrets.NEXUS_DOCKER_PUB_USERNAME }}
password: ${{ secrets.NEXUS_DOCKER_PUB_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
# See: https://github.com/docker/metadata-action
uses: docker/metadata-action@v4
with:
images: ${{ inputs.registry }}/${{ inputs.image }}
tags: |
type=raw,value=${{ inputs.branch }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: ${{ inputs.context }}
push: true
target: drn-dgm-runner
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
CACHE_DATE=${{ github.event.repository.updated_at }}-${{ github.run_id }}-${{ github.run_attempt }}