Skip to content

Production deployment #1138

Production deployment

Production deployment #1138

Workflow file for this run

name: Production deployment
on:
workflow_dispatch:
inputs:
git-ref:
description: Git revision (optional)
required: false
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Login to DockerHub
run: docker login -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Additional plugins
run: ${{ secrets.ENABLE_PLUGIN }}
- name: Build docker image
run: >
docker build -t 4programmers/coyote:$GITHUB_SHA -t 4programmers/coyote:latest -f docker/coyote/Dockerfile \
--build-arg FRONTEND_SENTRY_DSN=${{ secrets.FRONTEND_SENTRY_DSN }} \
--build-arg VAPID_PUBLIC_KEY=${{ secrets.VAPID_PUBLIC_KEY }} \
--build-arg SENTRY_API_KEY=${{ secrets.SENTRY_API_KEY }} \
--build-arg RELEASE=$GITHUB_RUN_ID .
- name: Push to docker registry
run: docker push -a 4programmers/coyote
- name: Update production docker images
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PRODUCTION_IP }}
username: ${{ secrets.PRODUCTION_LOGIN }}
key: ${{ secrets.PRODUCTION_KEY }}
port: 22
envs: GITHUB_SHA
script: |
sudo docker service update --image 4programmers/coyote:$GITHUB_SHA coyote_php
sudo docker service update --image 4programmers/coyote:$GITHUB_SHA coyote_worker
sudo docker service update --image 4programmers/coyote:$GITHUB_SHA coyote_cron
- name: Notify sentry
uses: getsentry/[email protected]
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: coyote
SENTRY_PROJECT: backend
with:
environment: production
ignore_empty: "true"
ignore_missing: "true"
projects: backend