Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions .github/workflows/backend-build-push.yml

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CD

on:
push:
branches: [ main ]
workflow_dispatch:

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build & push frontend image
uses: docker/build-push-action@v4
with:
context: ./frontend
push: true
tags: dastraus007/notes-app-frontend:latest

- name: Build & push backend image
uses: docker/build-push-action@v4
with:
context: ./backend
push: true
tags: dastraus007/notes-app-backend:latest

deploy-to-vm:
runs-on: ubuntu-latest
needs: build-and-push
steps:
- name: Copy docker‑compose.yml to server
uses: appleboy/scp-action@v0.1.8
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
source: docker-compose.yml
target: /home/${{ secrets.SERVER_USER }}/notes-app/

- name: SSH & deploy
uses: appleboy/ssh-action@v0.1.8
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
cd notes-app
docker-compose pull
docker-compose down
docker-compose up -d --remove-orphans
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

on:
push:
branches: [ main ]
pull_request:

jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
service: [frontend, backend]

steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install & lint ${{ matrix.service }}
working-directory: ./${{ matrix.service }}
run: |
npm ci
npm run lint

- name: Test ${{ matrix.service }}
working-directory: ./${{ matrix.service }}
run: npm test
46 changes: 0 additions & 46 deletions .github/workflows/frontend-build-push.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .idea/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/AndroidProjectSystem.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/encodings.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/indexLayout.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Notes‑App CI/CD

## What’s here

- **CI** (`ci.yml`): on push/PR builds, lints & tests both services.
- **CD** (`cd.yml`): on merge to `main`, builds Docker images, pushes to Docker Hub, then SSHs into your VM and does a rolling `docker-compose up`.

## Prerequisites

1. **VM** must have Docker & Docker Compose installed.
2. SSH key (with passphrase‑less access) in `~/.ssh/authorized_keys`.
3. GitHub Secrets configured:
- `DOCKERHUB_USERNAME`, `DOCKERHUB_TOKEN`
- `SERVER_HOST`, `SERVER_USER`, `SERVER_SSH_KEY`

## Usage

- Push or PR → ✅ CI runs.
- Merge into `main` → ✅ CD runs automatically.
- You can also manually trigger CD in the Actions tab (workflow_dispatch).

Binary file added Screenshot 2025-07-12 221204.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added photo_2025-07-12_22-10-59.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added photo_2025-07-12_22-11-06.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading