Deploy #117
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: Deploy | |
on: | |
workflow_run: | |
workflows: ['Lint, Test and Docker Build'] | |
types: | |
- completed | |
branches: [main] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: production | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v2 | |
- name: Make envfile | |
uses: SpicyPizza/create-envfile@v1 | |
with: | |
envkey_APPLICATION_HOST: ${{ secrets.APPLICATION_HOST }} | |
envkey_APPLICATION_PORT: ${{ secrets.APPLICATION_PORT }} | |
envkey_APPLICATION_JWT_SECRET: ${{ secrets.APPLICATION_JWT_SECRET }} | |
envkey_APPLICATION_DB_HOST: ${{ secrets.APPLICATION_DB_HOST }} | |
envkey_APPLICATION_DB_USERNAME: ${{ secrets.APPLICATION_DB_USERNAME }} | |
envkey_APPLICATION_DB_PASSWORD: ${{ secrets.APPLICATION_DB_PASSWORD }} | |
envkey_APPLICATION_DB_DATABASE: ${{ secrets.APPLICATION_DB_DATABASE }} | |
envkey_APPLICATION_DB_PORT: ${{ secrets.APPLICATION_DB_PORT }} | |
envkey_APPLICATION_DB_DIALECT: ${{ secrets.APPLICATION_DB_DIALECT }} | |
envkey_APPLICATION_REDIS_HOST: ${{ secrets.APPLICATION_REDIS_HOST }} | |
directory: ./ | |
file_name: .env.production | |
- id: docker-build | |
uses: ./.github/actions/docker-build | |
with: | |
docker-hub-username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
docker-hub-access-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
push: 'true' | |
- name: Image digest | |
run: echo ${{ steps.docker-build.outputs.docker-build-digest }} | |
- name: Actualize docker images on VPS | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
username: ${{ secrets.VPS_USERNAME }} | |
key: ${{ secrets.VPS_SSH_KEY }} | |
passphrase: ${{ secrets.VPS_SSH_KEY_PASSPHRASE }} | |
script_stop: true | |
script: | | |
cd ${{ secrets.VPS_PROJECT_PATH }} | |
docker-compose pull | |
docker-compose up -d --no-deps |