-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-base-docker-image-generic.yml
More file actions
62 lines (58 loc) · 1.99 KB
/
Copy pathbuild-base-docker-image-generic.yml
File metadata and controls
62 lines (58 loc) · 1.99 KB
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
on:
workflow_call:
inputs:
dockerImage:
required: true
type: string
dockerUsername:
description: 'Used to write latest images after the PR is merged in main'
required: true
type: string
dockerRoUsername:
description: 'Used to read the images (FROM: clause in the Dockerfile) to test the Dockerfile in the PR'
required: true
type: string
eventOrganizations:
required: false
default: ''
type: string
eventType:
required: true
type: string
environment:
required: false
default: 'release'
type: string
secrets:
DOCKERHUB_TOKEN:
required: true
docker-ro-token:
required: true
repo-token:
required: true
jobs:
build:
runs-on: ubuntu-latest
environment:
name: ${{ github.ref == 'refs/heads/main' && inputs.environment || '' }}
steps:
- name: Checkout sources
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 v4.2.2
- name: Login to Docker Hub
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
username: ${{ github.ref != 'refs/heads/main' && inputs.dockerRoUsername || inputs.dockerUsername }}
password: ${{ github.ref != 'refs/heads/main' && secrets.docker-ro-token || secrets.DOCKERHUB_TOKEN }}
- name: Build and publish Docker image
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ inputs.dockerImage }}
- name: Broadcast update event
if: github.ref == 'refs/heads/main'
uses: gridsuite/broadcast-event@67201bc793618876822097ce2152b23b496a8227 # main
with:
token: ${{ secrets.repo-token }}
organizations: ${{ inputs.eventOrganizations }}
event-type: ${{ inputs.eventType }}