Skip to content

Separate deploy images #74

Separate deploy images

Separate deploy images #74

Workflow file for this run

name: Build & Deploy to VPS
on:
push:
branches:
- main
env:
REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-images:
runs-on: ubuntu-latest
strategy:
matrix:

Check failure on line 15 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / Build & Deploy to VPS

Invalid workflow file

The workflow is not valid. .github/workflows/deploy.yml (Line: 15, Col: 20): Unexpected value ''
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and Push Images
run: |
cd docker/frontend
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/portfolio-frontend:latest .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/portfolio-frontend:latest
ls
cd ../../docker/nginx
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/portfolio-nginx:latest .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/portfolio-nginx:latest
- name: Build and Push Nginx Image
run: |
deploy:
runs-on: ubuntu-latest
needs: build-and-push-image
steps:
- name: Login via SSH and deploy on server
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd ~/deployments/portfolio
docker compose pull
docker compose down
docker compose up -d