-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (102 loc) · 3.4 KB
/
docker-release.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Docker Release
on:
workflow_call:
inputs:
PROJECT:
type: string
required: true
FULLNAME_OVERRIDE:
type: string
required: false
default: ""
GCP_REGISTRY:
type: string
required: false
default: "eu.gcr.io"
DOCKER_METADATA_OUTPUT_TAGS:
type: string
required: true
DOCKER_METADATA_OUTPUT_ANNOTATIONS:
type: string
required: true
DOCKER_METADATA_OUTPUT_LABELS:
type: string
required: true
DOCKER_METADATA_OUTPUT_JSON:
type: string
required: true
DOCKER_METADATA_OUTPUT_VERSION:
type: string
required: true
GCP_PROJECT_ID:
type: string
required: true
GAR_REGISTRY:
type: string
required: false
default: "europe-west3-docker.pkg.dev"
GAR_REPOSITORY:
type: string
required: false
default: "images"
secrets:
GCR_JSON_KEY:
required: true
jobs:
docker-release:
runs-on: ubuntu-22.04
steps:
- name: lowercase things
id: lowercase
env:
project: ${{inputs.PROJECT}}
postfix: ${{inputs.DOCKER_IMAGE_TAG_POSTFIX}}
run: |
echo "project=${project,,}" >> "$GITHUB_OUTPUT"
echo "postfix=${postfix,,}" >> "$GITHUB_OUTPUT"
- name: download a build artifact
uses: actions/[email protected]
id: download
with:
name: artifacts_image_${{steps.lowercase.outputs.project}}
- name: docker load
run: docker image load --input image_${{steps.lowercase.outputs.project}}.tar
- name: tag image
run: |
TAGS="${{inputs.DOCKER_METADATA_OUTPUT_TAGS}}"
for tag in ${TAGS}; do
docker tag image_${{steps.lowercase.outputs.project}}:gha "${tag}"
done
# - name: tag image
# run: |
# docker tag image_${{inputs.PROJECT}}:gha ${{ inputs.GCP_REGISTRY }}/${{ inputs.GCP_PROJECT_ID }}/${{ inputs.FULLNAME_OVERRIDE && inputs.FULLNAME_OVERRIDE || steps.lowercase.outputs.project }}:${{ inputs.DOCKER_IMAGE_TAG }}${{steps.lowercase.outputs.postfix}}
# docker image ls -a
- name: login to gcr
uses: docker/[email protected]
with:
registry: ${{ inputs.GCP_REGISTRY }}
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}
- name: push to registry
run: |
# VERSIONS="${{DOCKER_METADATA_OUTPUT_VERSION}}"
LABELS="${{DOCKER_METADATA_OUTPUT_LABELS}}"
ANNOTATIONS="${{DOCKER_METADATA_OUTPUT_ANNOTATIONS}}"
JSON="${{DOCKER_METADATA_OUTPUT_JSON}}"
TAGS="${{inputs.DOCKER_METADATA_OUTPUT_TAGS}}"
for version in ${VERSIONS}; do
echo "${version}"
done
for label in ${LABELS}; do
echo "${label}"
done
for annotation in ${ANNOTATIONS}; do
echo "${annotation}"
done
for json in ${JSON}; do
echo "${json}"
done
for tag in ${TAGS}; do
echo "${tag}"
# docker push ${{ inputs.GCP_REGISTRY }}/${{ inputs.GCP_PROJECT_ID }}/${{ inputs.FULLNAME_OVERRIDE && inputs.FULLNAME_OVERRIDE || steps.lowercase.outputs.project }}:${tag}${{steps.lowercase.outputs.postfix}}
done