Deploy Latest Studio Docker Images (3scale-dev) #1
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: Deploy Latest Studio Docker Images (3scale-dev) | |
on: | |
workflow_dispatch: | |
workflow_call: | |
secrets: | |
ACCESS_TOKEN: | |
required: true | |
GOOGLE_CHAT_WEBHOOK: | |
required: true | |
GOOGLE_CHAT_WEBHOOK_ERRORS: | |
required: true | |
jobs: | |
deploy-latest-studio: | |
name: Deploy Latest Studio Image | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'apicurio' | |
env: | |
API_IMAGE: quay.io/apicurio/apicurio-studio | |
UI_IMAGE: quay.io/apicurio/apicurio-studio-ui | |
IMAGE_TAG: latest-snapshot | |
steps: | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Get digest (UI) | |
run: | | |
docker pull ${{ env.UI_IMAGE }}:${{ env.IMAGE_TAG }} | |
docker image inspect ${{ env.UI_IMAGE }}:${{ env.IMAGE_TAG }} | |
STUDIO_UI_DOCKER_IMAGE=$(docker image inspect --format='{{index .RepoDigests 0}}' ${{ env.UI_IMAGE }}:${{ env.IMAGE_TAG }}) | |
echo "STUDIO_UI_DOCKER_IMAGE=$STUDIO_UI_DOCKER_IMAGE" >> $GITHUB_ENV | |
- name: Echo the Docker Image | |
run: | | |
echo " UI image: $STUDIO_UI_DOCKER_IMAGE" | |
- name: Code Checkout | |
run: | | |
mkdir repo | |
cd repo | |
git init | |
git config --global user.name "apicurio-ci" | |
git config --global user.email "[email protected]" | |
git remote add origin "https://apicurio-ci:${{ secrets.ACCESS_TOKEN }}@github.com/Apicurio/apicurio-3scale-gitops.git" | |
git fetch | |
git checkout main | |
git branch --set-upstream-to=origin/main | |
git pull | |
- name: Update UI Docker Image | |
run: | | |
cd repo/applications/apicurio-studio/ | |
yaml set deployment-ui.yaml spec.template.spec.containers.0.image ${{ env.STUDIO_UI_DOCKER_IMAGE }} > deployment-ui-NEW.yaml | |
rm deployment-ui.yaml | |
mv deployment-ui-NEW.yaml deployment-ui.yaml | |
- name: Verify Changed Deployment | |
run: | | |
cd repo | |
echo "---" | |
cat applications/apicurio-studio/deployment-ui.yaml | |
echo "---" | |
- name: Commit Changes | |
run: | | |
cd repo | |
git add . | |
git commit -m 'Automatic upgrade of Studio container images.' | |
git push origin main | |
- name: Google Chat Notification (Always) | |
if: always() | |
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1 | |
with: | |
name: ${{ github.job }} | |
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }} | |
status: ${{ job.status }} | |
- name: Google Chat Notification (Error) | |
if: failure() | |
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1 | |
with: | |
name: ${{ github.job }} | |
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_ERRORS }} | |
status: ${{ job.status }} |