Merge pull request #46 from computebender/45-improve-about-me-page-de… #18
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 and Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v2 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/${{ github.repository_owner }}/benmunrome:latest | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build-and-push | |
steps: | |
- name: Deploy to VPS | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.DO_HOST }} | |
username: ${{ secrets.DO_USER }} | |
key: ${{ secrets.DO_PRIVATE_KEY }} | |
script: | | |
cd /var/www/benmunrome | |
git pull origin main | |
docker compose down | |
docker compose pull | |
docker compose up -d |