generated from strg-at/template-basic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-image-exists-github.yaml
More file actions
59 lines (54 loc) · 1.67 KB
/
docker-image-exists-github.yaml
File metadata and controls
59 lines (54 loc) · 1.67 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
---
name: check if docker image exists in github
on:
workflow_call:
inputs:
runner:
description: '["some-runners"]'
required: true
type: string
registry:
description: "registry url"
required: false
type: string
default: "ghcr.io"
subpath:
description: "subpath to image name, f.e. integration/app-name"
required: true
type: string
tag:
description: "tag for image - default sha"
required: false
type: string
default: ${{ github.sha }}
outputs:
tag:
description: "found || not found"
value: ${{ jobs.check-image-exists.outputs.tag }}
jobs:
check-image-exists:
name: github
runs-on: ${{fromJSON(inputs.runner)}}
permissions:
contents: read
packages: read
env:
image-path: ${{ inputs.registry }}/${{ github.repository }}/${{ inputs.subpath }}
outputs:
tag: ${{ steps.inspect.outputs.tag }}
steps:
# https://github.com/marketplace/actions/docker-login
- name: log into registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ${{ inputs.registry }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# https://github.com/marketplace/actions/docker-image-tag-exists
- name: inspect
id: inspect
uses: tyriis/docker-image-tag-exists@71a750a41aa78e4efb0842f538140c5df5b8166f # v2.1.0
with:
registry: ${{ inputs.registry }}
repository: ${{ github.repository }}/${{ inputs.subpath }}
tag: ${{ inputs.tag }}