Skip to content

Merge branch 'develop' into fix#23-implement-cicd-setup #4

Merge branch 'develop' into fix#23-implement-cicd-setup

Merge branch 'develop' into fix#23-implement-cicd-setup #4

Workflow file for this run

name: CD
on:
workflow_dispatch:
pull_request:
types: [closed]
branches: [develop]
jobs:
deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/dev:latest
- name: Add SSH
push: true

Check failure on line 36 in .github/workflows/cd.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/cd.yml

Invalid workflow file

You have an error in your yaml syntax on line 36
tags: ${{ secrets.DOCKER_USERNAME }}/dev:latest
- name: Add SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Deploy to server
run: |
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
docker pull ${{ secrets.DOCKER_USERNAME }}/dev:latest
docker stop app || true
docker rm app || true
docker run -d --name app -p 80:80 ${{ secrets.DOCKER_USERNAME }}/dev:latest
docker image prune -f
EOF