-
Notifications
You must be signed in to change notification settings - Fork 3
78 lines (74 loc) · 2.99 KB
/
deploy.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
68
69
70
71
72
73
74
75
76
77
78
name: Build and deploy to IBM Cloud Functions
# Execute on every push to main
on:
release: # Execute when a release is created on the master branch
types:
- created
workflow_dispatch:
# Environment variables available to all jobs and steps in this workflow
env:
IBM_CLOUD_REGION: ${{secrets.IBM_CLOUD_REGION}}
IBM_CLOUD_GROUP: ${{secrets.IBM_CLOUD_GROUP}}
IBM_CLOUD_SPACE: ${{secrets.IBM_CLOUD_SPACE}}
IBM_CLOUD_ORG: ${{secrets.IBM_CLOUD_ORG}}
IBM_CLOUD_API: ${{secrets.IBM_CLOUD_API_KEY}}
jobs:
package-deploy-fn:
name: Package and deploy an OpenWhisk action to IBM Cloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: populate manifest file
run: |
cat manifest.yaml | grep -i value:
sed "s/\$IOT_HOST/${{secrets.IOT_HOST}}/" --in-place='' manifest.yaml
sed "s/\$IOT_PROTOCOL/${{secrets.IOT_PROTOCOL}}/" --in-place='' manifest.yaml
sed "s/\$IOT_USERNAME/${{secrets.IOT_USERNAME}}/" --in-place='' manifest.yaml
sed "s/\$IOT_SECURE_PORT/${{secrets.IOT_SECURE_PORT}}/" --in-place='' manifest.yaml
sed "s/\$IOT_PORT/${{secrets.IOT_PORT}}/" --in-place='' manifest.yaml
sed "s/\$IOT_CLIENTID/${{secrets.IOT_CLIENTID}}/" --in-place='' manifest.yaml
sed "s/\$IOT_PEM/${{secrets.IOT_PEM}}/" --in-place='' manifest.yaml
sed "s/\$IOT_FIREFIGHTER_ID/${{secrets.IOT_FIREFIGHTER_ID}}/" --in-place='' manifest.yaml
sed "s/\$IOT_DEVICE_ID/${{secrets.IOT_DEVICE_ID}}/" --in-place='' manifest.yaml
sed "s/\$IOT_PASSWORD/${{secrets.IOT_PASSWORD}}/" --in-place='' manifest.yaml
- name: create pem file
env:
IOT_PEM_CERT: ${{ secrets.IOT_PEM_CERT }}
run: |
echo "$IOT_PEM_CERT" >> ./action/messaging.pem
echo "running ls **"
ls -lta ./action
echo "finished running ls **"
- name: Install IBM CLI
run: |
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
ibmcloud --version
ibmcloud config --check-version=false
shell: bash
- name: Install fn plugin
run: ibmcloud plugin install cloud-functions
shell: bash
- name: Log into IBM Cloud
run: |
ibmcloud login --apikey "$IBM_CLOUD_API" -r "$IBM_CLOUD_REGION" -g "$IBM_CLOUD_GROUP"
shell: bash
- name: Target CF
run: ibmcloud target --cf-api https://api.$IBM_CLOUD_REGION.cf.cloud.ibm.com -r $IBM_CLOUD_REGION -o $IBM_CLOUD_ORG -s $IBM_CLOUD_SPACE
shell: bash
- name: List all functions
run: ibmcloud fn list
shell: bash
- name: uninstall functions first
run: ibmcloud fn undeploy
shell: bash
- name: install package
run: npm install
shell: bash
working-directory: action
- name: Install actions
run: ibmcloud fn deploy
shell: bash
working-directory: .
- name: List all functions
run: ibmcloud fn list
shell: bash