You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Repository to demonstrate how Github Actions can be used to deploy your source code to IBM Cloud Code Engine
1
+
# Code Engine GitHub Action
2
+
3
+
This GitHub Action allows you to interact with IBM Cloud Code Engine. Deploy Apps, Jobs, and Functions. It offers flexibility for different deployment types and provides various configuration options.
|`api-key`| ✅ | - | IAM API Key used to log into the IBM Cloud. Please store your IBM Cloud API key securely in your GitHub repository Secrets.|
10
+
|`resource-group`| ❌ | Your Default Resource Group | An IBM Cloud Resource Group, a logical container for organizing and managing related cloud resources.|
11
+
|`region`| ✅ | - | The geographical area where your Code Engine project is located, like `eu-de`[codeengine-regions](https://cloud.ibm.com/docs/codeengine?topic=codeengine-regions)|
12
+
|`project`| ✅ | - | The unique identifier (GUID) or the name that identifies your IBM Cloud Code Engine project. |
13
+
|`component`| ✅ | - | The type of component to deploy. allowed values `application`, `app`, `function`, `func`, `fn`, `job`|
14
+
|`name`| ✅ | - | The name of the App, Function, or Job.|
15
+
|`runtime`| ❌ | - | The runtime used for the Function. Currently supported `nodejs-18` and `python-3.11` see [IBM Code Engine Function Runtimes](https://cloud.ibm.com/docs/codeengine?topic=codeengine-fun-runtime) for more information.|
16
+
|`build-source`| ❌ | . | Path to the directory containing the source code.|
17
+
|`cpu`| ❌ | - | CPU value set for your component [Config for Functions](https://cloud.ibm.com/docs/codeengine?topic=codeengine-fun-runtime), [Codeengine Memory CPU combo](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo)|
18
+
|`memory`| ❌ | - | Memory value set for your component [Config for Functions](https://cloud.ibm.com/docs/codeengine?topic=codeengine-fun-runtime), [Codeengine Memory CPU combo](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo)|
19
+
20
+
21
+
22
+
## Usage and Example
23
+
24
+
To use this action, add it to your GitHub Actions workflow YAML file also make sure to add your IBM Cloud API Key as GitHub Action Repository Secret. There is a example for deploying an App, Job and Python/Nodejs Function.
25
+
26
+
*Deploy an App: `deploy-app.yml`*: Deploy your app to `Default` resource-group in `eu-de` to the project `MY-PROJECT` with its source code in the root of the repository the name of the app is`my-app`.
27
+
```yaml
28
+
name: Deploy App to Code Engine
29
+
30
+
on:
31
+
push:
32
+
branches:
33
+
- main
34
+
workflow_dispatch:
35
+
36
+
jobs:
37
+
38
+
deploy-app:
39
+
runs-on: ubuntu-latest
40
+
steps:
41
+
- name: Check out code
42
+
uses: actions/checkout@v3
43
+
44
+
- name: Deploy Application to Code Engine
45
+
uses: IBM/code-engine-github-action@v1
46
+
with:
47
+
api-key: ${{ secrets.IBM_IAM_API_KEY }}
48
+
resource-group: 'Default'
49
+
region: 'eu-de'
50
+
project: 'MY-PROJECT'
51
+
component: 'app'
52
+
name: 'my-app'
53
+
build-source: './'
54
+
cpu: 1
55
+
memory: 4G
56
+
```
57
+
58
+
*Deploy a Job: `deploy-job.yml`*: Deploy your Job to `Default` resource-group in `eu-de` to the project `MY-PROJECT` with its source code in the root of the repository the name of the job is`my-job`.
59
+
```yaml
60
+
name: Deploy App to Code Engine
61
+
62
+
on:
63
+
push:
64
+
branches:
65
+
- main
66
+
workflow_dispatch:
67
+
68
+
jobs:
69
+
70
+
deploy-job:
71
+
runs-on: ubuntu-latest
72
+
steps:
73
+
- name: Check out code
74
+
uses: actions/checkout@v3
75
+
76
+
- name: Deploy Job to Code Engine
77
+
uses: IBM/code-engine-github-action@v1
78
+
with:
79
+
api-key: ${{ secrets.IBM_IAM_API_KEY }}
80
+
resource-group: 'Default'
81
+
region: 'eu-de'
82
+
project: 'MY-PROJECT'
83
+
component: 'job'
84
+
name: 'my-job'
85
+
build-source: './'
86
+
cpu: 1
87
+
memory: 4G
88
+
```
89
+
90
+
*Deploy a NodeJS Function: `deploy-nodejs-func.yml`*: Deploy your NodeJS Function to `Default` resource-group in `eu-de` to the project `MY-PROJECT` with its source code in the root of the repository the name of the function is`my-js-fn`.
91
+
```yaml
92
+
name: Deploy a NodeJS Function to Code Engine
93
+
94
+
on:
95
+
push:
96
+
branches:
97
+
- main
98
+
workflow_dispatch:
99
+
100
+
jobs:
101
+
102
+
deploy-nodejs-junc:
103
+
runs-on: ubuntu-latest
104
+
steps:
105
+
- name: Check out code
106
+
uses: actions/checkout@v3
107
+
108
+
- name: Deploy JavaScript Function to Code Engine
109
+
uses: IBM/code-engine-github-action@v1
110
+
with:
111
+
api-key: ${{ secrets.IBM_IAM_API_KEY }}
112
+
resource-group: 'Default'
113
+
region: 'eu-de'
114
+
project: 'MY-PROJECT'
115
+
component: 'fn'
116
+
runtime: nodejs-18
117
+
name: 'my-js-fn'
118
+
build-source: './'
119
+
cpu: 1
120
+
memory: 4G
121
+
```
122
+
123
+
*Deploy a Python Function: `deploy-python-func.yml`*: Deploy your Python Function to `Default` resource-group in `eu-de` to the project `MY-PROJECT` with its source code in the root of the repository the name of the function is`my-py-fn`.
0 commit comments