Skip to content

Deploy to Dev

Deploy to Dev #5

Workflow file for this run

name: Deploy to Dev
on:
workflow_dispatch:
inputs:
image-tag:
type: string
description: "The tag of the docker images to deploy"
required: true
jobs:
check-if-image-exists:
runs-on: ubuntu-latest
steps:
- name: Check if image exists
run: |
IMAGE_NAME=ls1intum/apollon_standalone
ENCODED_TOKEN=$(echo -n "${{ secrets.GITHUB_TOKEN }}" | base64)
TAG_EXISTS=$(curl -s -H "Authorization: Bearer ${ENCODED_TOKEN}" \
https://ghcr.io/v2/${IMAGE_NAME}/tags/list \
| jq -r --arg TAG "${{ inputs.image-tag }}" '.tags[] | select(. == $TAG)')
if [ -z "$TAG_EXISTS" ]; then
echo "Image ${IMAGE_NAME}:${{ inputs.image-tag }} does not exist."
exit 1
else
echo "Image ${IMAGE_NAME}:${{ inputs.image-tag }} exists."
fi
deploy:
needs: check-if-image-exists
# TODO: uses: ls1intum/.github/.github/workflows/deploy-docker-compose.yml@main
uses: ./.github/workflows/deploy-docker-compose-shared.yml
with:
environment: Dev
docker-compose-file: "./docker-compose.prod.yml"
image-tag: ${{ inputs.image-tag }}
env-vars: |
DEPLOYMENT_URL=${{ vars.DEPLOYMENT_URL }}
APOLLON_REDIS_DIAGRAM_TTL=${{ vars.APOLLON_REDIS_DIAGRAM_TTL }}
secrets: inherit