released #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}" |