-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (36 loc) · 1.35 KB
/
ibm-cloud.yml
File metadata and controls
45 lines (36 loc) · 1.35 KB
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
name: Deploy to IBM Cloud
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install IBM Cloud CLI
run: |
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
ibmcloud plugin install code-engine -f
ibmcloud plugin install container-registry -f
- name: Login to IBM Cloud
run: |
ibmcloud login --apikey ${{ secrets.IBM_CLOUD_API_KEY }} -r us-south
- name: Login to IBM Container Registry
run: |
ibmcloud cr login
- name: Build Docker image
run: |
IMAGE=${{ secrets.IBM_CR_REGION }}/${{ secrets.IBM_CR_NAMESPACE }}/${{ secrets.IBM_CR_REPOSITORY }}:latest
docker build -t $IMAGE .
- name: Push image to IBM Container Registry
run: |
IMAGE=${{ secrets.IBM_CR_REGION }}/${{ secrets.IBM_CR_NAMESPACE }}/${{ secrets.IBM_CR_REPOSITORY }}:latest
docker push $IMAGE
- name: Deploy to IBM Code Engine
run: |
ibmcloud ce project select -n ${{ secrets.IBM_CE_PROJECT }}
ibmcloud ce app update \
--name ${{ secrets.IBM_CE_APP_NAME }} \
--image ${{ secrets.IBM_CR_REGION }}/${{ secrets.IBM_CR_NAMESPACE }}/${{ secrets.IBM_CR_REPOSITORY }}:latest