-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (85 loc) · 3.21 KB
/
shared-publish-to-docker-versioned.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Shared Pipeline to build and publish images to Docker
on:
workflow_call:
inputs:
release_type:
description: The type of version number to return. Must be one of [Snapshot, Patch, Minor or Major]
required: true
type: string
new_version:
description: The new version number to publish for the docker repo
required: true
type: string
image_tag:
description: The image tag used to extract metadata for Docker
required: true
type: string
docker_file:
description: The Dockerfile used to build and publish Docker image
type: string
default: ''
docker_image_name:
description: The docker image name
required: true
type: string
docker_registry:
description: The docker registry
required: true
type: string
docker_context:
description: The docker context
default: .
type: string
git_tag_or_hash:
description: The git tag or hash to checkout. If not provided, the commit that triggered the workflow will be used.
default: ''
type: string
force_release:
description: If 'yes', will force the creation a release, if 'no' will not create a release. 'branch' will use release_type and the branch to determine if a release should be created.
type: string
default: 'branch'
publish_vulnerabilities:
description: If true, will attempt to publish any vulnerabilities to GitHub. Defaults to true. Set to false for private repos.
type: string
default: 'true'
jobs:
buildImage:
name: Build Image
runs-on: ubuntu-latest
permissions:
contents: write
security-events: write
packages: write
pull-requests: write
steps:
- name: Setup
id: setup
uses: IABTechLab/uid2-shared-actions/actions/shared_publish_setup@v2
with:
release_type: ${{ inputs.release_type }}
git_tag_or_hash: ${{ inputs.git_tag_or_hash }}
force_release: ${{ inputs.force_release }}
- name: Publish to Docker
id: publishToDocker
uses: IABTechLab/uid2-shared-actions/actions/shared_publish_to_docker@v3
with:
new_version: ${{ inputs.new_version }}
image_tag: ${{ inputs.image_tag }}
not_snapshot: ${{ steps.setup.outputs.not_snapshot }}
github_token: ${{ secrets.GITHUB_TOKEN }}
docker_file: ${{ inputs.docker_file }}
docker_image_name: ${{ inputs.docker_image_name }}
docker_registry: ${{ inputs.docker_registry }}
docker_context: ${{ inputs.docker_context }}
publish_vulnerabilities: ${{ inputs.publish_vulnerabilities }}
scan_type: image
- name: Create Release
id: github_release
uses: IABTechLab/uid2-shared-actions/actions/shared_create_releases@v2
with:
is_release: ${{ steps.setup.outputs.is_release }}
new_version: ${{ inputs.new_version }}
tags: ${{ steps.publishToDocker.outputs.tags }}
image_tag: ${{ inputs.docker_image_name }}
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_platform: Docker