From a4af51cd0954c1ef9c01daa50d41c7e61089fe96 Mon Sep 17 00:00:00 2001 From: Amr Hossam <140510710+AbuMecca@users.noreply.github.com> Date: Tue, 27 Aug 2024 14:44:20 +0300 Subject: [PATCH] Update and rename CI\CD Pipeline to CI\CD Pipeline.yml --- ".github/workflows/CI\\CD Pipeline" | 21 --------- ".github/workflows/CI\\CD Pipeline.yml" | 61 +++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 21 deletions(-) delete mode 100644 ".github/workflows/CI\\CD Pipeline" create mode 100644 ".github/workflows/CI\\CD Pipeline.yml" diff --git "a/.github/workflows/CI\\CD Pipeline" "b/.github/workflows/CI\\CD Pipeline" deleted file mode 100644 index a6f7470..0000000 --- "a/.github/workflows/CI\\CD Pipeline" +++ /dev/null @@ -1,21 +0,0 @@ -name: CI/CD Pipeline -on: - push: - branches: - - main - pull_request: - types: [opened, synchronize, reopened] - -jobs: - sonarcloud: - name: SonarCloud - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git "a/.github/workflows/CI\\CD Pipeline.yml" "b/.github/workflows/CI\\CD Pipeline.yml" new file mode 100644 index 0000000..8f8b7f3 --- /dev/null +++ "b/.github/workflows/CI\\CD Pipeline.yml" @@ -0,0 +1,61 @@ +name: CI/CD Pipeline +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] + +jobs: + sonarcloud: + name: SonarCloud + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + build: + runs-on: ubuntu-latest + needs: sonarcloud + steps: + + - name: Checkout code + uses: actions/checkout@v2 + + - name: List files in the build context + run: ls -R /home/runner/work/IBM-Tasks/IBM-Tasks + + - name: Set up minikube + uses: sagikazarmark/setup-minikube-action@v0 + + - name: Start Minikube + run: | + minikube start + + - name: Set up Podman + run: | + sudo apt-get update + sudo apt-get install -y podman + - name: Build Docker image with Podman + run: | + podman build -t docker.io/amrhossam235/myapp:${{ github.sha }} . + - name: List Docker images + run: | + podman images + + - name: Show Docker image details + run: | + podman inspect docker.io/amrhossam235/myapp:${{ github.sha }} + + - name: Push Docker image to Docker Hub + run: | + echo $DOCKER_PASSWORD | podman login --username $DOCKER_USERNAME --password-stdin docker.io + podman push docker.io/amrhossam235/myapp:${{ github.sha }} docker://docker.io/amrhossam235/myapp:${{ github.sha }} + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}