Build & Deploy #231
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: Build & Deploy | |
on: | |
# Manually triggered from the UI | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: "Environment" | |
required: true | |
type: environment | |
# Dependency to a forking workflow | |
#workflow_run: | |
# workflows: ["Django CI"] | |
# types: [completed] | |
jobs: | |
build_docker: | |
runs-on: ubuntu-latest | |
environment: ${{ github.event.inputs.environment }} | |
concurrency: ${{ github.event.inputs.environment }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to packages container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build image | |
run: | | |
make build-docker-image | |
make tag-${{ github.event.inputs.environment }} | |
- name: Deploy to server | |
uses: appleboy/ssh-action@master | |
with: | |
host: maaa-registration | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
proxy_host: ${{ secrets.SSH_HOST }} | |
proxy_username: ${{ secrets.SSH_USERNAME }} | |
proxy_key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
cd /opt/docker | |
docker-compose pull | |
docker-compose up -d |