Merge pull request #7 from SnowdenWintermute/feature #11
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: Deployment | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push client | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: snowd3n/roguelike-racing:client | |
file: ./dockerfiles/client.Dockerfile | |
- | |
name: Build and push server | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: snowd3n/roguelike-racing:server | |
file: ./dockerfiles/server.Dockerfile | |
deploy: | |
needs: build-and-push | |
runs-on: ubuntu-latest | |
steps: | |
- name: connect to vps, pull docker images and relaunch docker compose | |
uses: garygrossgarten/github-action-ssh@release | |
with: | |
command: cd /app && docker-compose down && docker-compose pull && docker-compose up -d | |
host: ${{ secrets.VPS_HOST_ADDRESS }} | |
username: ${{ secrets.VPS_USERNAME }} | |
password: ${{ secrets.VPS_PASSWORD }} | |