forked from syslog-ng/syslog-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (55 loc) · 1.73 KB
/
publish-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
name: Publish Docker image
on:
workflow_call:
inputs:
pkg-type:
required: true
type: string # stable / nightly
secrets:
dockerhub-username:
required: true
dockerhub-password:
required: true
env:
DOCKER_IMAGE_NAME: balabit/syslog-ng
jobs:
publish-docker-image:
name: Publish syslog-ng Docker image
if: github.repository_owner == 'syslog-ng'
runs-on: ubuntu-latest
steps:
- name: Checkout syslog-ng source
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.dockerhub-username }}
password: ${{ secrets.dockerhub-password }}
- name: Extract metadata (syslog-ng version) for Docker
if: inputs.pkg-type == 'stable'
id: stable-tags
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_IMAGE_NAME }}
tags: type=match,pattern=syslog-ng-(.*),group=1
sep-tags: ','
- name: Compose Docker image tags
id: tags
run: |
if [[ '${{ inputs.pkg-type }}' = 'stable' ]]; then
TAGS='${{ steps.stable-tags.outputs.tags }}'
elif [[ '${{ inputs.pkg-type }}' = 'nightly' ]]; then
TAGS="${DOCKER_IMAGE_NAME}:nightly"
else
echo Unexpected input: pkg-type=${{ inputs.pkg-type }}
false
fi
. .github/workflows/gh-tools.sh
gh_output TAGS
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: docker/
push: true
tags: ${{ steps.tags.outputs.TAGS }}
build-args: PKG_TYPE=${{ inputs.pkg-type }}