Skip to content

Continuous Deployment #1

Continuous Deployment

Continuous Deployment #1

Workflow file for this run

name: Continuous Deployment
on:
workflow_run:
workflows: ["Continuous Integration"]
types:
- completed
workflow_dispatch:
jobs:
build-microservice-images:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Log in to GHCR
run: echo "${{ secrets.REPO_ADMIN_GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.REPO_ADMIN_GH_USERNAME }}" --password-stdin
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r assets/pipeline/config/requirements.github.cd.txt
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
- name: Authorize push script
run: chmod +x ./assets/docker/scripts/deploy_microservice.sh
- name: Build API microservice image
run: |
rm -f gateway/spec/openapi_3_1_0_generated.yaml
python -B gateway/openapi_spec.py
sudo rm -rf gateway/__pycache__
docker-compose build gateway
- name: Deploy API microservice container to GHCR
run: |
./assets/docker/scripts/deploy_microservice.sh gateway
env:
REPO_ADMIN_GH_USERNAME: ${{ secrets.REPO_ADMIN_GH_USERNAME }}
REPO_ADMIN_GHCR_TOKEN: ${{ secrets.REPO_ADMIN_GHCR_TOKEN }}
- name: Build worker microservice image
run: |
sudo rm -rf worker/__pycache__
docker-compose build worker
- name: Deploy worker microservice container to GHCR
run: |
./assets/docker/scripts/deploy_microservice.sh worker
env:
REPO_ADMIN_GH_USERNAME: ${{ secrets.REPO_ADMIN_GH_USERNAME }}
REPO_ADMIN_GHCR_TOKEN: ${{ secrets.REPO_ADMIN_GHCR_TOKEN }}