Skip to content

Deploy feature branch to test #70

Deploy feature branch to test

Deploy feature branch to test #70

name: 'Deploy feature branch to test'
on:
workflow_dispatch:
push:
branches: ['feature-*']
paths-ignore:
- docs/**
- README.md
- .github/**
- cloudformation/**
- db_scripts/**
- jenkins/**
- kibana-proxy/**
- postgresql/**
env:
AWS_REGION: us-east-1
permissions:
id-token: write
contents: read
jobs:
deploy:
name: Deploy Feature Branch to Test
runs-on: ubuntu-latest
environment:
name: feature
steps:
- name: Install system packages
run: |
sudo apt-get update -qy && sudo apt-get dist-upgrade -qy && sudo apt-get install -qy \
libmemcached-dev libz-dev libfreetype6-dev libtiff-dev \
libjpeg-dev libopenjp2-7-dev libwebp-dev zlib1g-dev libpq-dev
- name: Install node and npm
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ vars.FEATURE_BRANCH }}
fetch-depth: 0
fetch-tags: 'true'
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.10'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
- name: Install Python Dependencies and Retrieve Version Number
id: python-build
run: |
python3 -m pip install --upgrade pip
pip3 install -U setuptools
pip3 install -U setuptools-scm
FULL_VERSION_NUMBER="$(python3 -m setuptools_scm)"
echo "version_number=$(echo "${FULL_VERSION_NUMBER}" | cut -d '+' -f 1)" >> $GITHUB_ENV
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
role-session-name: github_to_aws_deploy
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag and push docker images ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ secrets.IMAGE_TAG }}
CLUSTER: ${{ secrets.CLUSTER }}
TARGET_SERVICE: ${{ secrets.TARGET_SERVICE }}
run: |
docker build -t concordia .
docker tag concordia:latest $REGISTRY/concordia:$version_number
docker tag concordia:latest $REGISTRY/concordia:$IMAGE_TAG
docker push $REGISTRY/concordia:$version_number
docker push $REGISTRY/concordia:$IMAGE_TAG
docker build -t concordia/importer --file importer/Dockerfile .
docker tag concordia/importer:latest $REGISTRY/concordia/importer:$version_number
docker tag concordia/importer:latest $REGISTRY/concordia/importer:$IMAGE_TAG
docker push $REGISTRY/concordia/importer:$version_number
docker push $REGISTRY/concordia/importer:$IMAGE_TAG
docker build -t concordia/celerybeat --file celerybeat/Dockerfile .
docker tag concordia/celerybeat:latest $REGISTRY/concordia/celerybeat:$version_number
docker tag concordia/celerybeat:latest $REGISTRY/concordia/celerybeat:$IMAGE_TAG
docker push $REGISTRY/concordia/celerybeat:$version_number
docker push $REGISTRY/concordia/celerybeat:$IMAGE_TAG
aws ecs update-service --region ${{ env.AWS_REGION }} --force-new-deployment --cluster $CLUSTER --service $TARGET_SERVICE