-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update and rename CI\CD Pipeline to CI\CD Pipeline.yml
- Loading branch information
Showing
2 changed files
with
61 additions
and
21 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |