Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
294 changes: 294 additions & 0 deletions .github/workflows/production-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
name: Production Deploy

on:
workflow_dispatch:
inputs:
deploy_api:
description: Deploy api service?
required: true
type: boolean
deploy_job_generator:
description: Deploy job-generator service?
required: true
type: boolean
deploy_nodejs_worker:
description: Deploy nodejs-worker service?
required: true
type: boolean
deploy_python_worker:
description: Deploy python-worker service?
required: true
type: boolean
deploy_frontend:
description: Deploy frontend?
required: true
type: boolean
deploy_premium_api:
description: Deploy premium-api service?
required: true
type: boolean
deploy_premium_python_worker:
description: Deploy premium-python-worker service?
required: true
type: boolean
deploy_premium_job_generator:
description: Deploy premium-job-generator service?
required: true
type: boolean

env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
CROWD_CLUSTER: ${{ secrets.STAGING_CLUSTER_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}

jobs:
build-and-push-backend:
runs-on: ubuntu-latest
if: ${{ inputs.deploy_api || inputs.deploy_job_generator || inputs.deploy_nodejs_worker }}
outputs:
image: ${{ steps.image.outputs.IMAGE }}
defaults:
run:
shell: bash
steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/build-docker-image
id: image-builder
with:
image: backend

- name: Set docker image output
id: image
run: echo "IMAGE=${{ steps.image-builder.outputs.image }}" >> $GITHUB_OUTPUT

build-and-push-frontend:
runs-on: ubuntu-latest
if: ${{ inputs.deploy_frontend }}
outputs:
image: ${{ steps.image.outputs.IMAGE }}
defaults:
run:
shell: bash
steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/build-docker-image
id: image-builder
with:
image: frontend

- name: Set docker image output
id: image
run: echo "IMAGE=${{ steps.image-builder.outputs.image }}" >> $GITHUB_OUTPUT

build-and-push-python-worker:
runs-on: ubuntu-latest
if: ${{ inputs.deploy_python_worker }}
outputs:
image: ${{ steps.image.outputs.IMAGE }}
defaults:
run:
shell: bash
steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/build-docker-image
id: image-builder
with:
image: python-worker

- name: Set docker image output
id: image
run: echo "IMAGE=${{ steps.image-builder.outputs.image }}" >> $GITHUB_OUTPUT

build-and-push-premium-job-generator:
runs-on: ubuntu-latest
if: ${{ inputs.deploy_premium_job_generator }}
outputs:
image: ${{ steps.image.outputs.IMAGE }}
defaults:
run:
shell: bash
steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/build-docker-image
id: image-builder
with:
image: premium-job-generator

- name: Set docker image output
id: image
run: echo "IMAGE=${{ steps.image-builder.outputs.image }}" >> $GITHUB_OUTPUT

build-and-push-premium-python-backend:
runs-on: ubuntu-latest
if: ${{ inputs.deploy_premium_api || inputs.deploy_premium_python_worker }}
outputs:
image: ${{ steps.image.outputs.IMAGE }}
defaults:
run:
shell: bash
steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/build-docker-image
id: image-builder
with:
image: premium-python-backend

- name: Set docker image output
id: image
run: echo "IMAGE=${{ steps.image-builder.outputs.image }}" >> $GITHUB_OUTPUT

deploy-api:
needs: build-and-push-backend
runs-on: ubuntu-latest
if: ${{ inputs.deploy_api }}
defaults:
run:
shell: bash
steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/deploy-service
with:
service: api
image: ${{ needs.build-and-push-backend.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}

deploy-nodejs-worker:
needs: build-and-push-backend
runs-on: ubuntu-latest
if: ${{ inputs.deploy_nodejs_worker }}
defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/deploy-service
with:
service: nodejs-worker
image: ${{ needs.build-and-push-backend.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}

deploy-job-generator:
needs: build-and-push-backend
runs-on: ubuntu-latest
if: ${{ inputs.deploy_job_generator }}
defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/deploy-service
with:
service: job-generator
image: ${{ needs.build-and-push-backend.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}

deploy-frontend:
needs: build-and-push-frontend
runs-on: ubuntu-latest
if: ${{ inputs.deploy_frontend }}
defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/deploy-service
with:
service: frontend
image: ${{ needs.build-and-push-frontend.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}

deploy-python-worker:
needs: build-and-push-python-worker
runs-on: ubuntu-latest
if: ${{ inputs.deploy_python_worker }}
defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/deploy-service
with:
service: python-worker
image: ${{ needs.build-and-push-python-worker.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}

deploy-premium-job-generator:
needs: build-and-push-premium-job-generator
runs-on: ubuntu-latest
if: ${{ inputs.deploy_premium_job_generator }}
defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/deploy-service
with:
service: premium-job-generator
image: ${{ needs.build-and-push-premium-job-generator.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}

deploy-premium-python-worker:
needs: build-and-push-premium-python-backend
runs-on: ubuntu-latest
if: ${{ inputs.deploy_premium_python_worker }}
defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/deploy-service
with:
service: premium-python-worker
image: ${{ needs.build-and-push-premium-python-backend.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}

deploy-premium-api:
needs: build-and-push-premium-python-backend
runs-on: ubuntu-latest
if: ${{ inputs.deploy_premium_api }}
defaults:
run:
shell: bash

steps:
- name: Check out repository code
uses: actions/checkout@v2

- uses: ./.github/actions/deploy-service
with:
service: premium-api
image: ${{ needs.build-and-push-premium-python-backend.outputs.image }}
cluster: ${{ env.CROWD_CLUSTER }}