Skip to content

Commit

Permalink
version0 pipeline catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
waelABDALLAH1 committed Nov 11, 2024
1 parent 5e5cbeb commit 930bade
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/catalog-service-ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI/CD Pipeline

on:
push:
branches:
- service-catalog
pull_request:
branches:
- service-catalog

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'

- name: Build with Quarkus
run: |
cd catalog/catalog-service/
quarkus build
- name: Run Tests
run: |
cd catalog/catalog-service/
quarkus test
- name: Set Docker Image Tag
id: docker_tag
run: echo "tag=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV

- name: Build Docker image
run: |
cd catalog/catalog-service/
docker-compose up --build -d
- name: Push Docker image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push <dockerhub_username>/<image_name>:${{ env.tag }}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to VM
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.VM_HOST }}
username: ${{ secrets.VM_USERNAME }}
key: ${{ secrets.VM_SSH_KEY }}
script: |
docker pull <dockerhub_username>/<image_name>:${{ needs.build.outputs.tag }}
docker-compose down
docker-compose up -d

0 comments on commit 930bade

Please sign in to comment.