-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (42 loc) · 1.59 KB
/
deploy-image.yaml
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
name: Update deployment
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
repository_dispatch:
types: [ released ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
setup:
runs-on: ubuntu-latest
outputs:
image: ${{ steps.variables.outputs.image }}
steps:
- run: "echo 'Deploy: ${{ github.event.client_payload.ref }}'"
- name: Setup variables
id: variables
shell: bash
run: |
REF="${{ github.event.client_payload.ref }}"
RELEASE_TAG=${REF#refs/tags/}
IMAGE="${{vars.IMAGE_BASE}}:${RELEASE_TAG}"
echo "Release tag: ${RELEASE_TAG}"
echo "release-tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
echo "Image: ${IMAGE}"
echo "image=$IMAGE" >> $GITHUB_OUTPUT
deploy:
runs-on: ubuntu-latest
container:
image: quay.io/cloudnativetoolkit/cli-tools-ibmcloud:v1.2-v0.6.1-alpine
options: --user devops
needs: setup
env:
HOME: /home/devops
steps:
- name: IBM Cloud CE plugin
run: ibmcloud plugin install code-engine -f
- name: IBM Cloud login
run: ibmcloud login -r "${{vars.REGION}}" -g "${{vars.RESOURCE_GROUP}}" --apikey "${{secrets.IBMCLOUD_APIKEY}}"
- name: Update application
run: |
ibmcloud ce project select --name "${{vars.CE_PROJECT_NAME}}"
ibmcloud ce application update --name "${{vars.CE_APP_NAME}}" -i "${{ needs.setup.outputs.image }}"