Skip to content

Commit a95d75c

Browse files
authored
Create ibm-cloud.yml
1 parent 5ed4cfe commit a95d75c

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/ibm-cloud.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Deploy to IBM Cloud
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Install IBM Cloud CLI
17+
run: |
18+
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
19+
ibmcloud plugin install code-engine -f
20+
ibmcloud plugin install container-registry -f
21+
22+
- name: Login to IBM Cloud
23+
run: |
24+
ibmcloud login --apikey ${{ secrets.IBM_CLOUD_API_KEY }} -r us-south
25+
26+
- name: Login to IBM Container Registry
27+
run: |
28+
ibmcloud cr login
29+
30+
- name: Build Docker image
31+
run: |
32+
IMAGE=${{ secrets.IBM_CR_REGION }}/${{ secrets.IBM_CR_NAMESPACE }}/${{ secrets.IBM_CR_REPOSITORY }}:latest
33+
docker build -t $IMAGE .
34+
35+
- name: Push image to IBM Container Registry
36+
run: |
37+
IMAGE=${{ secrets.IBM_CR_REGION }}/${{ secrets.IBM_CR_NAMESPACE }}/${{ secrets.IBM_CR_REPOSITORY }}:latest
38+
docker push $IMAGE
39+
40+
- name: Deploy to IBM Code Engine
41+
run: |
42+
ibmcloud ce project select -n ${{ secrets.IBM_CE_PROJECT }}
43+
ibmcloud ce app update \
44+
--name ${{ secrets.IBM_CE_APP_NAME }} \
45+
--image ${{ secrets.IBM_CR_REGION }}/${{ secrets.IBM_CR_NAMESPACE }}/${{ secrets.IBM_CR_REPOSITORY }}:latest

0 commit comments

Comments
 (0)