Production deployment #522
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: Production deployment | |
on: | |
workflow_dispatch: | |
inputs: | |
git-ref: | |
description: Git Ref (Optional) | |
required: false | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Login to Docker hub | |
run: docker login -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build plugin | |
run: ${{ secrets.ENABLE_PLUGIN }} | |
- name: Build docker | |
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 registry | |
run: docker push -a 4programmers/coyote | |
- name: executing remote ssh commands using password | |
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: Sentry Release Backend | |
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 |