-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
67 lines (64 loc) · 2.11 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: "Build, Push and Deploy Action"
description: "This action builds a docker image, pushes to IBM Cloud Registry"
inputs:
github-sha:
description: "GitHub SHA value"
required: true
cloud-api-key:
description: "IBM Cloud API Key"
required: true
cloud-resource-group:
description: "Cloud Resource Group"
required: false
default: "default"
cloud-region:
description: "IBM Cloud Region"
required: false
default: "us-south"
icr-region:
description: "Container Registry Region"
required: false
default: "us-south"
icr-namespace:
description: "IBM Cloud Container Registry namespace"
required: true
registry-hostname:
description: "IBM Cloud Registry hostname"
required: false
default: "us.icr.io"
image-name:
description: "Docker image name"
required: true
deployment-name:
description: "Deployment name on Kubernetes"
required: true
container-name:
description: "Name of the container to set image for"
required: true
working-directory:
description: "Working directory that contains a Dockerfile"
required: false
default: "."
runs:
using: "composite"
steps:
- id: ibmcloud-cli
run: |
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
ibmcloud --version
ibmcloud config --check-version=false
ibmcloud plugin install -f container-registry
shell: bash
- id: login-to-ibmcloud-cli
run: |
ibmcloud login --apikey "${{ inputs.cloud-api-key }}" -r "${{ inputs.cloud-region }}" -g "${{ inputs.cloud-resource-group }}"
ibmcloud cr region-set "${{ inputs.icr-region }}"
ibmcloud cr login
shell: bash
- id: build-with-docker
run: docker build --tag "${{ inputs.registry-hostname }}"/"${{ inputs.icr-namespace }}"/"${{ inputs.image-name }}":"${{ inputs.github-sha }}" "."
shell: bash
working-directory: ${{ inputs.working-directory }}
- id: push-to-icr
run: docker push "${{ inputs.registry-hostname }}"/"${{ inputs.icr-namespace }}"/"${{ inputs.image-name }}":"${{ inputs.github-sha }}"
shell: bash