-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
47 lines (40 loc) · 1.3 KB
/
action.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
name: 'Podman Build & Push (GCR)'
description: 'Build and Push action for Google Container Registry'
branding:
icon: "upload-cloud"
color: "blue"
inputs:
host: # id of input
description: "registry host"
required: false
default: "gcr.io"
auth_type:
description: "Authentication type ( _json_key / 0auth2accesstoken )"
required: false
default: "jsonkey"
project_id:
description: "project id"
required: true
access_token:
description: "access token or json key"
required: true
image_id:
description: "image tag name"
required: true
runs:
using: "composite"
steps:
- name:
if: inputs.auth_type == 'jsonkey'
run: echo ${{ inputs.access_token }} | base64 -d | podman login -u _json_key --password-stdin ${{ inputs.host }}
shell: bash
- name: Google Container Registry Authorization
if: inputs.auth_type == 'oauth2'
run: echo ${{ inputs.access_token }} | podman login -u oauth2accesstoken --password-stdin ${{ inputs.host }}
shell: bash
- name: Build the image
run: podman build . -t ${{ inputs.image_id }}
shell: bash
- name: Push the image to the Container Registry
run: podman push ${{ inputs.image_id }} ${{ inputs.host }}/${{ inputs.project_id }}/${{ inputs.image_id }}
shell: bash