fix #362
Workflow file for this run
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: Push | |
on: | |
push: | |
branches: [ prod, dev, staging ] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get changed files | |
id: get_file_changes | |
uses: trilom/[email protected] | |
with: | |
output: ' ' | |
- name: Release changed client | |
if: contains(steps.get_file_changes.outputs.files, 'app/client') || contains(github.event.head_commit.message, 'trigger build') | |
run: make release-client-docker-image -e COMPONENT=client | |
- name: Release changed api | |
if: contains(steps.get_file_changes.outputs.files, 'app/api') || contains(github.event.head_commit.message, 'trigger build') | |
run: make release-docker-image -e COMPONENT=api | |
- name: Some check on branch | |
id: branch_check | |
run: | | |
echo "Running on branch ${{ github.ref }}" | |
if [ "${{ github.ref }}" = "refs/heads/prod" ]; then | |
echo "::set-output name=env_name::main" | |
elif [ "${{ github.ref }}" = "refs/heads/staging" ]; then | |
echo "::set-output name=env_name::staging" | |
else | |
echo "::set-output name=env_name::dev" | |
fi | |
- name: Use variable setup in previous step | |
run: echo "I'm using variable ${{ steps.branch_check.outputs.env_name }}" | |
outputs: | |
env_name: ${{ steps.branch_check.outputs.env_name }} | |
deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ needs.release.outputs.env_name }} | |
needs: [release] | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} | |
POSTGRES_DB: ${{ secrets.POSTGRES_DB }} | |
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }} | |
R5_HOST: ${{ secrets.R5_HOST }} | |
R5_AUTHORIZATION: ${{ secrets.R5_AUTHORIZATION }} | |
API_SECRET_KEY: ${{ secrets.API_SECRET_KEY }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
EMAILS_FROM_EMAIL: ${{ secrets.EMAILS_FROM_EMAIL }} | |
FIRST_ORGANIZATION: ${{ secrets.FIRST_ORGANIZATION }} | |
FIRST_SUPERUSER_EMAIL: ${{ secrets.FIRST_SUPERUSER_EMAIL }} | |
FIRST_SUPERUSER_PASSWORD: ${{ secrets.FIRST_SUPERUSER_PASSWORD }} | |
FIRST_SUPERUSER_NAME: ${{ secrets.FIRST_SUPERUSER_NAME }} | |
FIRST_SUPERUSER_SURNAME: ${{ secrets.FIRST_SUPERUSER_SURNAME }} | |
SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }} | |
BACKEND_CORS_ORIGIN: ${{ secrets.BACKEND_CORS_ORIGIN }} | |
RABBITMQ_DEFAULT_USER: ${{ secrets.RABBITMQ_DEFAULT_USER }} | |
RABBITMQ_DEFAULT_PASS: ${{ secrets.RABBITMQ_DEFAULT_PASS }} | |
CELERY_RESULT_EXPIRES: ${{ vars.CELERY_RESULT_EXPIRES }} | |
CELERY_TASK_TIME_LIMIT: ${{ vars.CELERY_TASK_TIME_LIMIT }} | |
API_REPLICAS: ${{ vars.API_REPLICAS }} | |
WORKER_REPLICAS: ${{ vars.WORKER_REPLICAS }} | |
WORKER_MEMORY_LIMIT: ${{ vars.WORKER_MEMORY_LIMIT }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-central-1 | |
- uses: azure/[email protected] | |
with: | |
version: 'v1.23.6' # default is latest stable | |
id: install | |
- name: Get changed files | |
id: get_file_changes | |
uses: trilom/[email protected] | |
with: | |
output: ' ' | |
- name: Deploy postgres-service | |
run: make deploy -e COMPONENT=postgres | |
- name: Deploy rabbitmq | |
run: make deploy -e COMPONENT=rabbitmq | |
- name: Deploy redis | |
run: make deploy -e COMPONENT=redis | |
- name: Deploy celery-flower | |
run: make deploy -e COMPONENT=celery-flower | |
- name: Deploy changed client | |
if: contains(steps.get_file_changes.outputs.files, 'app/client') || contains(github.event.head_commit.message, 'trigger build') | |
run: make deploy -e COMPONENT=client | |
- name: Deploy changed api | |
if: contains(steps.get_file_changes.outputs.files, 'app/api') || contains(github.event.head_commit.message, 'trigger build') | |
run: make deploy -e COMPONENT=api | |
- name: Deploy changed ingress | |
run : make deploy -e COMPONENT=ingress |