Skip to content

deploy

deploy #423

Workflow file for this run

name: deploy
on:
push:
branches:
- main
schedule:
- cron: "0 12 * * 1"
workflow_dispatch:
workflow_call:
jobs:
build-node:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: saiemgilani/game-on-paper-app
- name: Publish Node container to GitHub
uses: mr-smithers-excellent/[email protected]
with:
image: saiemgilani/game-on-paper-node
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}
directory: ./frontend
dockerfile: ./frontend/Dockerfile
tags: latest
build-python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: saiemgilani/game-on-paper-app
- name: Publish Python container to GitHub
uses: mr-smithers-excellent/[email protected]
with:
image: saiemgilani/game-on-paper-python
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}
directory: ./python
dockerfile: ./python/Dockerfile
tags: latest
build-redis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: saiemgilani/game-on-paper-app
- name: Publish Redis container to GitHub
uses: mr-smithers-excellent/[email protected]
with:
image: saiemgilani/game-on-paper-redis
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}
directory: ./redis
dockerfile: ./redis/Dockerfile.lru
tags: latest
- name: Publish Redis container to GitHub
uses: mr-smithers-excellent/[email protected]
with:
image: saiemgilani/game-on-paper-cache
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}
directory: ./redis
dockerfile: ./redis/Dockerfile.cache
tags: latest
deploy:
runs-on: ubuntu-latest
needs:
- build-node
- build-python
- build-redis
steps:
- uses: actions/checkout@v3
with:
repository: saiemgilani/game-on-paper-app
- name: Push updated docker-compose override file
uses: vtisweden/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
localPath: './docker-compose.do.yml'
remotePath: './docker-compose.yml'
- name: Deploy package to DigitalOcean
uses: appleboy/ssh-action@master
env:
GITHUB_USERNAME: ${{ secrets.GH_USERNAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_COMPOSE_FILE: ${{ env.DOCKER_COMPOSE_FILE }}
DOCKER_COMPOSE_OVERRIDE_FILE: ${{ env.DOCKER_COMPOSE_OVERRIDE_FILE }}
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
envs: GITHUB_USERNAME, GITHUB_TOKEN, DOCKER_COMPOSE_FILE, DOCKER_COMPOSE_OVERRIDE_FILE
script: |
docker stop $(docker ps -a -q)
docker system prune --force
docker login ghcr.io -u $GITHUB_USERNAME -p $GITHUB_TOKEN
docker-compose pull
docker-compose -f docker-compose.yml up -d